server.js 581 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194
  1. /* ====================================================================
  2. |
  3. | Amber Smalltalk
  4. | http://amber-lang.net
  5. |
  6. ======================================================================
  7. ======================================================================
  8. |
  9. | Copyright (c) 2010-2011
  10. | Nicolas Petton <petton.nicolas@gmail.com>
  11. |
  12. | Amber is released under the MIT license
  13. |
  14. | Permission is hereby granted, free of charge, to any person obtaining
  15. | a copy of this software and associated documentation files (the
  16. | 'Software'), to deal in the Software without restriction, including
  17. | without limitation the rights to use, copy, modify, merge, publish,
  18. | distribute, sublicense, and/or sell copies of the Software, and to
  19. | permit persons to whom the Software is furnished to do so, subject to
  20. | the following conditions:
  21. |
  22. | The above copyright notice and this permission notice shall be
  23. | included in all copies or substantial portions of the Software.
  24. |
  25. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  26. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  28. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  29. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  30. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  31. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. |
  33. ==================================================================== */
  34. /* Make sure that console is defined */
  35. if(typeof console === "undefined") {
  36. this.console = {
  37. log: function() {},
  38. warn: function() {},
  39. info: function() {},
  40. debug: function() {},
  41. error: function() {}
  42. };
  43. }
  44. /* Array extensions */
  45. Array.prototype.addElement = function(el) {
  46. if(typeof el === 'undefined') { return; }
  47. if(this.indexOf(el) == -1) {
  48. this.push(el);
  49. }
  50. };
  51. Array.prototype.removeElement = function(el) {
  52. var i = this.indexOf(el);
  53. if (i !== -1) { this.splice(i, 1); }
  54. };
  55. /* Smalltalk constructors definition */
  56. function SmalltalkObject() {}
  57. function SmalltalkBehavior() {}
  58. function SmalltalkClass() {}
  59. function SmalltalkMetaclass() {
  60. this.meta = true;
  61. }
  62. function SmalltalkPackage() {}
  63. function SmalltalkMethod() {}
  64. function SmalltalkNil() {}
  65. function SmalltalkSymbol(string) {
  66. this.value = string;
  67. }
  68. function SmalltalkOrganizer() {
  69. this.elements = [];
  70. }
  71. function inherits(child, parent) {
  72. child.prototype = Object.create(parent.prototype, {
  73. constructor: { value: child,
  74. enumerable: false, configurable: true, writable: true }
  75. });
  76. }
  77. inherits(SmalltalkBehavior, SmalltalkObject);
  78. inherits(SmalltalkClass, SmalltalkBehavior);
  79. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  80. inherits(SmalltalkNil, SmalltalkObject);
  81. inherits(SmalltalkMethod, SmalltalkObject);
  82. inherits(SmalltalkPackage, SmalltalkObject);
  83. inherits(SmalltalkOrganizer, SmalltalkObject);
  84. function Smalltalk() {
  85. var st = this;
  86. /* This is the current call context object. While it is publicly available,
  87. Use smalltalk.getThisContext() instead which will answer a safe copy of
  88. the current context */
  89. st.thisContext = undefined;
  90. /* List of all reserved words in JavaScript. They may not be used as variables
  91. in Smalltalk. */
  92. // list of reserved JavaScript keywords as of
  93. // http://es5.github.com/#x7.6.1.1
  94. // and
  95. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  96. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  97. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  98. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  99. 'try', 'typeof', 'var', 'void', 'while', 'with',
  100. // ES5: future use: http://es5.github.com/#x7.6.1.2
  101. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  102. // ES5: future use in strict mode
  103. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  104. 'public', 'static', 'yield'];
  105. var initialized = false;
  106. /* Smalltalk classes */
  107. var classes = [];
  108. var wrappedClasses = [];
  109. /* Method not implemented handlers */
  110. var dnu = {
  111. methods: [],
  112. selectors: [],
  113. get: function (string) {
  114. var index = this.selectors.indexOf(string);
  115. if(index !== -1) {
  116. return this.methods[index];
  117. }
  118. this.selectors.push(string);
  119. var selector = st.selector(string);
  120. var method = {jsSelector: selector, fn: this.createHandler(selector)};
  121. this.methods.push(method);
  122. return method;
  123. },
  124. /* Dnu handler method */
  125. createHandler: function (selector) {
  126. return function () {
  127. var args = Array.prototype.slice.call(arguments);
  128. return messageNotUnderstood(this, selector, args);
  129. };
  130. }
  131. };
  132. /* The symbol table ensures symbol unicity */
  133. var symbolTable = {};
  134. st.symbolFor = function(string) {
  135. if(symbolTable[string] === undefined) {
  136. symbolTable[string] = new SmalltalkSymbol(string);
  137. }
  138. return symbolTable[string];
  139. };
  140. /* Unique ID number generator */
  141. var oid = 0;
  142. st.nextId = function() {
  143. oid += 1;
  144. return oid;
  145. };
  146. /* We hold all Packages in a separate Object */
  147. st.packages = {};
  148. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  149. function pkg(spec) {
  150. var that = new SmalltalkPackage();
  151. that.pkgName = spec.pkgName;
  152. that.organization = new SmalltalkOrganizer();
  153. that.properties = spec.properties || {};
  154. return that;
  155. }
  156. /* Smalltalk class creation. A class is an instance of an automatically
  157. created metaclass object. Newly created classes (not their metaclass)
  158. should be added to the smalltalk object, see smalltalk.addClass().
  159. Superclass linking is *not* handled here, see smalltalk.init() */
  160. function klass(spec) {
  161. spec = spec || {};
  162. var meta = metaclass(spec);
  163. var that = meta.instanceClass;
  164. that.fn = spec.fn || function() {};
  165. setupClass(that, spec);
  166. that.className = spec.className;
  167. that.wrapped = spec.wrapped || false;
  168. meta.className = spec.className + ' class';
  169. if(spec.superclass) {
  170. that.superclass = spec.superclass;
  171. meta.superclass = spec.superclass.klass;
  172. }
  173. return that;
  174. }
  175. function metaclass(spec) {
  176. spec = spec || {};
  177. var that = new SmalltalkMetaclass();
  178. inherits(
  179. that.fn = function() {},
  180. spec.superclass ? spec.superclass.klass.fn : SmalltalkClass
  181. );
  182. that.instanceClass = new that.fn();
  183. setupClass(that);
  184. return that;
  185. }
  186. function setupClass(klass, spec) {
  187. spec = spec || {};
  188. klass.iVarNames = spec.iVarNames || [];
  189. klass.pkg = spec.pkg;
  190. Object.defineProperty(klass, "toString", {
  191. value: function() { return 'Smalltalk ' + this.className; },
  192. enumerable:false, configurable: true, writable: false
  193. });
  194. klass.organization = new SmalltalkOrganizer();
  195. Object.defineProperty(klass, "methods", {
  196. value: {},
  197. enumerable: false, configurable: true, writable: true
  198. });
  199. wireKlass(klass);
  200. }
  201. /* Smalltalk method object. To add a method to a class,
  202. use smalltalk.addMethod() */
  203. st.method = function(spec) {
  204. var that = new SmalltalkMethod();
  205. that.selector = spec.selector;
  206. that.jsSelector = spec.jsSelector;
  207. that.args = spec.args || {};
  208. that.category = spec.category;
  209. that.source = spec.source;
  210. that.messageSends = spec.messageSends || [];
  211. that.referencedClasses = spec.referencedClasses || [];
  212. that.fn = spec.fn;
  213. return that;
  214. };
  215. /* Initialize a class in its class hierarchy. Handle both classes and
  216. metaclasses. */
  217. st.init = function(klass) {
  218. st.initClass(klass);
  219. if(klass.klass && !klass.meta) {
  220. st.initClass(klass.klass);
  221. }
  222. };
  223. st.initClass = function(klass) {
  224. if(klass.wrapped) {
  225. copySuperclass(klass);
  226. }
  227. else {
  228. installSuperclass(klass);
  229. }
  230. if(klass === st.Object || klass.wrapped) {
  231. installDnuHandlers(klass);
  232. }
  233. };
  234. function wireKlass(klass) {
  235. Object.defineProperty(klass.fn.prototype, "klass", {
  236. value: klass,
  237. enumerable: false, configurable: true, writable: true
  238. });
  239. }
  240. function installSuperclass(klass) {
  241. // only if the klass has not been initialized yet.
  242. if(klass.fn.prototype._yourself) { return; }
  243. if(klass.superclass && klass.superclass !== nil) {
  244. inherits(klass.fn, klass.superclass.fn);
  245. wireKlass(klass);
  246. reinstallMethods(klass);
  247. }
  248. }
  249. function copySuperclass(klass, superclass) {
  250. for (superclass = superclass || klass.superclass;
  251. superclass && superclass !== nil;
  252. superclass = superclass.superclass) {
  253. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  254. installMethodIfAbsent(superclass.methods[keys[i]], klass);
  255. }
  256. }
  257. }
  258. function installMethod(method, klass) {
  259. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  260. value: method.fn,
  261. enumerable: false, configurable: true, writable: true
  262. });
  263. }
  264. function installMethodIfAbsent(method, klass) {
  265. if(!klass.fn.prototype[method.jsSelector]) {
  266. installMethod(method, klass);
  267. }
  268. }
  269. function reinstallMethods(klass) {
  270. for(var keys = Object.keys(klass.methods), i=0; i<keys.length; i++) {
  271. installMethod(klass.methods[keys[i]], klass);
  272. }
  273. }
  274. function installDnuHandlers(klass) {
  275. var m = dnu.methods;
  276. for(var i=0; i<m.length; i++) {
  277. installMethodIfAbsent(m[i], klass);
  278. }
  279. }
  280. function installNewDnuHandler(newHandler) {
  281. installMethodIfAbsent(newHandler, st.Object);
  282. for(var i = 0; i < wrappedClasses.length; i++) {
  283. installMethodIfAbsent(newHandler, wrappedClasses[i]);
  284. }
  285. }
  286. /* Answer all registered Packages as Array */
  287. // TODO: Remove this hack
  288. st.packages.all = function() {
  289. var packages = [];
  290. for(var i in st.packages) {
  291. if(!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  292. packages.push(st.packages[i]);
  293. }
  294. return packages
  295. };
  296. /* Answer all registered Smalltalk classes */
  297. //TODO: remove the function and make smalltalk.classes an array
  298. st.classes = function() {
  299. return classes;
  300. };
  301. st.wrappedClasses = function() {
  302. return wrappedClasses;
  303. };
  304. /* Answer the direct subclasses of klass. */
  305. st.subclasses = function(klass) {
  306. var subclasses = [];
  307. var classes = st.classes();
  308. for(var i=0; i < classes.length; i++) {
  309. var c = classes[i];
  310. if(c.fn) {
  311. //Classes
  312. if(c.superclass === klass) {
  313. subclasses.push(c);
  314. }
  315. c = c.klass;
  316. //Metaclasses
  317. if(c && c.superclass === klass) {
  318. subclasses.push(c);
  319. }
  320. }
  321. }
  322. return subclasses;
  323. };
  324. /* Create a new class wrapping a JavaScript constructor, and add it to the
  325. global smalltalk object. Package is lazily created if it does not exist with given name. */
  326. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  327. if(wrapped !== false) {
  328. wrapped = true;
  329. }
  330. var pkg = st.addPackage(pkgName);
  331. st[className] = klass({
  332. className: className,
  333. superclass: superclass,
  334. pkg: pkg,
  335. fn: fn,
  336. wrapped: wrapped
  337. });
  338. classes.addElement(st[className]);
  339. if(wrapped) {wrappedClasses.addElement(st[className])}
  340. pkg.organization.elements.addElement(st[className]);
  341. };
  342. /* Create an alias for an existing class */
  343. st.alias = function(klass, alias) {
  344. st[alias] = klass;
  345. };
  346. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  347. If pkgName is null or empty we return nil, which is an allowed package for a class.
  348. If package already exists we still update the properties of it. */
  349. st.addPackage = function(pkgName, properties) {
  350. if(!pkgName) {return nil;}
  351. if(!(st.packages[pkgName])) {
  352. st.packages[pkgName] = pkg({
  353. pkgName: pkgName,
  354. properties: properties
  355. });
  356. } else {
  357. if(properties) {
  358. st.packages[pkgName].properties = properties;
  359. }
  360. }
  361. return st.packages[pkgName];
  362. };
  363. /* Add a class to the smalltalk object, creating a new one if needed.
  364. A Package is lazily created if it does not exist with given name. */
  365. st.addClass = function(className, superclass, iVarNames, pkgName) {
  366. var pkg = st.addPackage(pkgName);
  367. if (superclass == nil) { superclass = null; }
  368. if(st[className] && st[className].superclass == superclass) {
  369. st[className].superclass = superclass;
  370. st[className].iVarNames = iVarNames;
  371. st[className].pkg = pkg || st[className].pkg;
  372. } else {
  373. if(st[className]) {
  374. st.removeClass(st[className]);
  375. }
  376. st[className] = klass({
  377. className: className,
  378. superclass: superclass,
  379. pkg: pkg,
  380. iVarNames: iVarNames
  381. });
  382. }
  383. classes.addElement(st[className]);
  384. pkg.organization.elements.addElement(st[className]);
  385. };
  386. st.removeClass = function(klass) {
  387. klass.pkg.organization.elements.removeElement(klass);
  388. classes.removeElement(klass);
  389. delete st[klass.className];
  390. };
  391. /* Add/remove a method to/from a class */
  392. st.addMethod = function(jsSelector, method, klass) {
  393. method.jsSelector = jsSelector;
  394. installMethod(method, klass);
  395. klass.methods[method.selector] = method;
  396. method.methodClass = klass;
  397. klass.organization.elements.addElement(method.category);
  398. for(var i=0; i<method.messageSends.length; i++) {
  399. var dnuHandler = dnu.get(method.messageSends[i]);
  400. if(initialized) {
  401. installNewDnuHandler(dnuHandler);
  402. }
  403. }
  404. };
  405. st.removeMethod = function(method) {
  406. var protocol = method.category;
  407. var klass = method.methodClass;
  408. delete klass.fn.prototype[st.selector(method.selector)];
  409. delete klass.methods[method.selector];
  410. var selectors = Object.keys(klass.methods);
  411. var shouldDeleteProtocol = true;
  412. for(var i = 0, l = selectors.length; i<l; i++) {
  413. if(klass.methods[selectors[i]].category === protocol) {
  414. shouldDeleteProtocol = false;
  415. break;
  416. };
  417. };
  418. if(shouldDeleteProtocol) {
  419. klass.organization.elements.removeElement(protocol)
  420. };
  421. };
  422. /* Handles unhandled errors during message sends */
  423. // simply send the message and handle #dnu:
  424. st.send = function(receiver, selector, args, klass) {
  425. var method;
  426. if(receiver == null) {
  427. receiver = nil;
  428. }
  429. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  430. if(method) {
  431. return method.apply(receiver, args);
  432. } else {
  433. return messageNotUnderstood(receiver, selector, args);
  434. }
  435. }
  436. st.withContext = function(worker, setup) {
  437. if(st.thisContext) {
  438. st.thisContext.pc++;
  439. return inContext(worker, setup);
  440. } else {
  441. try {return inContext(worker, setup)}
  442. catch(error) {
  443. if(error.smalltalkError) {
  444. handleError(error);
  445. } else {
  446. var errorWrapper = st.JavaScriptException._on_(error);
  447. try {errorWrapper._signal()} catch(ex) {}
  448. errorWrapper._context_(st.getThisContext());
  449. handleError(errorWrapper);
  450. }
  451. // Reset the context stack in any case
  452. st.thisContext = undefined;
  453. // Throw the exception anyway, as we want to stop
  454. // the execution to avoid infinite loops
  455. throw error;
  456. }
  457. }
  458. };
  459. function inContext(worker, setup) {
  460. var context = pushContext(setup);
  461. var result = worker(context);
  462. popContext(context);
  463. return result;
  464. }
  465. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  466. (See the Smalltalk class ErrorHandler and its subclasses */
  467. function handleError(error) {
  468. st.ErrorHandler._current()._handleError_(error);
  469. }
  470. /* Handles #dnu: *and* JavaScript method calls.
  471. if the receiver has no klass, we consider it a JS object (outside of the
  472. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  473. function messageNotUnderstood(receiver, selector, args) {
  474. /* Handles JS method calls. */
  475. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  476. return callJavaScriptMethod(receiver, selector, args);
  477. }
  478. /* Handles not understood messages. Also see the Amber counter-part
  479. Object>>doesNotUnderstand: */
  480. return receiver._doesNotUnderstand_(
  481. st.Message._new()
  482. ._selector_(st.convertSelector(selector))
  483. ._arguments_(args)
  484. );
  485. }
  486. /* Call a method of a JS object, or answer a property if it exists.
  487. Else try wrapping a JSObjectProxy around the receiver.
  488. If the object property is a function, then call it, except if it starts with
  489. an uppercase character (we probably want to answer the function itself in this
  490. case and send it #new from Amber).
  491. Converts keyword-based selectors by using the first
  492. keyword only, but keeping all message arguments.
  493. Example:
  494. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  495. function callJavaScriptMethod(receiver, selector, args) {
  496. var jsSelector = selector._asJavaScriptSelector();
  497. var jsProperty = receiver[jsSelector];
  498. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  499. return jsProperty.apply(receiver, args);
  500. } else if(jsProperty !== undefined) {
  501. if(args[0]) {
  502. receiver[jsSelector] = args[0];
  503. return nil;
  504. } else {
  505. return jsProperty;
  506. }
  507. }
  508. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  509. }
  510. /* Handle thisContext pseudo variable */
  511. st.getThisContext = function() {
  512. if(st.thisContext) {
  513. st.thisContext.init();
  514. return st.thisContext;
  515. } else {
  516. return nil;
  517. }
  518. };
  519. function pushContext(setup) {
  520. return st.thisContext = new SmalltalkMethodContext(smalltalk.thisContext, setup);
  521. }
  522. function popContext(context) {
  523. st.thisContext = context.homeContext;
  524. }
  525. /* Convert a Smalltalk selector into a JS selector */
  526. st.selector = function(string) {
  527. var selector = '_' + string;
  528. selector = selector.replace(/:/g, '_');
  529. selector = selector.replace(/[\&]/g, '_and');
  530. selector = selector.replace(/[\|]/g, '_or');
  531. selector = selector.replace(/[+]/g, '_plus');
  532. selector = selector.replace(/-/g, '_minus');
  533. selector = selector.replace(/[*]/g ,'_star');
  534. selector = selector.replace(/[\/]/g ,'_slash');
  535. selector = selector.replace(/[\\]/g ,'_backslash');
  536. selector = selector.replace(/[\~]/g ,'_tild');
  537. selector = selector.replace(/>/g ,'_gt');
  538. selector = selector.replace(/</g ,'_lt');
  539. selector = selector.replace(/=/g ,'_eq');
  540. selector = selector.replace(/,/g ,'_comma');
  541. selector = selector.replace(/[@]/g ,'_at');
  542. return selector
  543. };
  544. /* Convert a string to a valid smalltalk selector.
  545. if you modify the following functions, also change String>>asSelector
  546. accordingly */
  547. st.convertSelector = function(selector) {
  548. if(selector.match(/__/)) {
  549. return convertBinarySelector(selector);
  550. } else {
  551. return convertKeywordSelector(selector);
  552. }
  553. };
  554. function convertKeywordSelector(selector) {
  555. return selector.replace(/^_/, '').replace(/_/g, ':');
  556. }
  557. function convertBinarySelector(selector) {
  558. return selector
  559. .replace(/^_/, '')
  560. .replace(/_and/g, '&')
  561. .replace(/_or/g, '|')
  562. .replace(/_plus/g, '+')
  563. .replace(/_minus/g, '-')
  564. .replace(/_star/g, '*')
  565. .replace(/_slash/g, '/')
  566. .replace(/_backslash/g, '\\')
  567. .replace(/_tild/g, '~')
  568. .replace(/_gt/g, '>')
  569. .replace(/_lt/g, '<')
  570. .replace(/_eq/g, '=')
  571. .replace(/_comma/g, ',')
  572. .replace(/_at/g, '@')
  573. }
  574. /* Converts a JavaScript object to valid Smalltalk Object */
  575. st.readJSObject = function(js) {
  576. var object = js;
  577. var readObject = (js.constructor === Object);
  578. var readArray = (js.constructor === Array);
  579. if(readObject) {
  580. object = st.Dictionary._new();
  581. }
  582. for(var i in js) {
  583. if(readObject) {
  584. object._at_put_(i, st.readJSObject(js[i]));
  585. }
  586. if(readArray) {
  587. object[i] = st.readJSObject(js[i]);
  588. }
  589. }
  590. return object;
  591. };
  592. /* Boolean assertion */
  593. st.assert = function(shouldBeBoolean) {
  594. if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
  595. return shouldBeBoolean == true;
  596. } else {
  597. smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  598. }
  599. };
  600. /* Smalltalk initialization. Called on page load */
  601. st.initialize = function() {
  602. if(initialized) { return; }
  603. classes.forEach(function(klass) {
  604. st.init(klass);
  605. });
  606. classes.forEach(function(klass) {
  607. klass._initialize();
  608. });
  609. initialized = true;
  610. };
  611. }
  612. inherits(Smalltalk, SmalltalkObject);
  613. function SmalltalkMethodContext(home, setup) {
  614. this.homeContext = home;
  615. this.setup = setup || function() {};
  616. this.pc = 0;
  617. }
  618. // Fallbacks
  619. SmalltalkMethodContext.prototype.locals = {};
  620. SmalltalkMethodContext.prototype.receiver = null;
  621. SmalltalkMethodContext.prototype.selector = null;
  622. SmalltalkMethodContext.prototype.lookupClass = null;
  623. inherits(SmalltalkMethodContext, SmalltalkObject);
  624. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  625. this.receiver = receiver;
  626. this.selector = selector;
  627. this.locals = locals || {};
  628. this.lookupClass = lookupClass;
  629. };
  630. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx) {
  631. this.locals = locals || {};
  632. this.methodContext = ctx;
  633. };
  634. SmalltalkMethodContext.prototype.init = function() {
  635. var home = this.homeContext;
  636. if(home) {home = home.init()}
  637. this.setup(this);
  638. };
  639. SmalltalkMethodContext.prototype.method = function() {
  640. var method;
  641. var lookup = this.lookupClass || this.receiver.klass;
  642. while(!method && lookup) {
  643. method = lookup.methods[smalltalk.convertSelector(this.selector)];
  644. lookup = lookup.superclass
  645. }
  646. return method;
  647. };
  648. // TODO: this is just wrong :)
  649. SmalltalkMethodContext.prototype.resume = function() {
  650. //Brutally set the receiver as thisContext, then re-enter the function
  651. smalltalk.thisContext = this;
  652. return this.method.apply(receiver, temps);
  653. };
  654. /* Global Smalltalk objects. */
  655. var nil = new SmalltalkNil();
  656. var smalltalk = new Smalltalk();
  657. if(this.jQuery) {
  658. this.jQuery.allowJavaScriptCalls = true;
  659. }
  660. /*
  661. * Answer the smalltalk representation of o.
  662. * Used in message sends
  663. */
  664. var _st = function(o) {
  665. if(o == null) {return nil}
  666. if(o.klass) {return o}
  667. return smalltalk.JSObjectProxy._on_(o);
  668. };
  669. /***************************************** BOOTSTRAP ******************************************/
  670. smalltalk.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false);
  671. smalltalk.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, smalltalk.Object, false);
  672. smalltalk.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, smalltalk.Behavior, false);
  673. smalltalk.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, smalltalk.Behavior, false);
  674. smalltalk.Object.klass.superclass = smalltalk.Class;
  675. smalltalk.wrapClassName("Smalltalk", "Kernel-Objects", Smalltalk, smalltalk.Object, false);
  676. smalltalk.wrapClassName("Package", "Kernel-Objects", SmalltalkPackage, smalltalk.Object, false);
  677. smalltalk.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, smalltalk.Object, false);
  678. smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object, false);
  679. smalltalk.wrapClassName("Number", "Kernel", Number, smalltalk.Object);
  680. smalltalk.wrapClassName("BlockClosure", "Kernel", Function, smalltalk.Object);
  681. smalltalk.wrapClassName("Boolean", "Kernel", Boolean, smalltalk.Object);
  682. smalltalk.wrapClassName("Date", "Kernel", Date, smalltalk.Object);
  683. smalltalk.wrapClassName("UndefinedObject", "Kernel", SmalltalkNil, smalltalk.Object, false);
  684. smalltalk.addClass("Collection", smalltalk.Object, null, "Kernel");
  685. smalltalk.addClass("SequenceableCollection", smalltalk.Collection, null, "Kernel");
  686. smalltalk.addClass("CharacterArray", smalltalk.SequenceableCollection, null, "Kernel");
  687. smalltalk.wrapClassName("String", "Kernel", String, smalltalk.CharacterArray);
  688. smalltalk.wrapClassName("Symbol", "Kernel", SmalltalkSymbol, smalltalk.CharacterArray, false);
  689. smalltalk.wrapClassName("Array", "Kernel", Array, smalltalk.SequenceableCollection);
  690. smalltalk.wrapClassName("RegularExpression", "Kernel", RegExp, smalltalk.Object);
  691. smalltalk.wrapClassName("Error", "Kernel", Error, smalltalk.Object);
  692. smalltalk.wrapClassName("MethodContext", "Kernel", SmalltalkMethodContext, smalltalk.Object, false);
  693. /* Alias definitions */
  694. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  695. smalltalk.alias(smalltalk.Date, "Time");
  696. smalltalk.addPackage('Kernel-Objects', {});
  697. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  698. smalltalk.Object.comment="*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.\x0a\x0aObject provides default behavior common to all normal objects, such as: \x0a\x0a- access\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aObject has no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aObjects understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a Overriding this message can be useful to implement proxies for example."
  699. smalltalk.addMethod(
  700. "__minus_gt",
  701. smalltalk.method({
  702. selector: "->",
  703. category: 'converting',
  704. fn: function (anObject){
  705. var self=this;
  706. return smalltalk.withContext(function($ctx1) { var $1;
  707. $1=_st((smalltalk.Association || Association))._key_value_(self,anObject);
  708. return $1;
  709. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject}, smalltalk.Object)})},
  710. args: ["anObject"],
  711. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  712. messageSends: ["key:value:"],
  713. referencedClasses: ["Association"]
  714. }),
  715. smalltalk.Object);
  716. smalltalk.addMethod(
  717. "__eq",
  718. smalltalk.method({
  719. selector: "=",
  720. category: 'comparing',
  721. fn: function (anObject){
  722. var self=this;
  723. return smalltalk.withContext(function($ctx1) { var $1;
  724. $1=_st(self).__eq_eq(anObject);
  725. return $1;
  726. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject}, smalltalk.Object)})},
  727. args: ["anObject"],
  728. source: "= anObject\x0a\x09^self == anObject",
  729. messageSends: ["=="],
  730. referencedClasses: []
  731. }),
  732. smalltalk.Object);
  733. smalltalk.addMethod(
  734. "__eq_eq",
  735. smalltalk.method({
  736. selector: "==",
  737. category: 'comparing',
  738. fn: function (anObject){
  739. var self=this;
  740. return smalltalk.withContext(function($ctx1) { var $1;
  741. $1=_st(_st(self)._identityHash()).__eq(_st(anObject)._identityHash());
  742. return $1;
  743. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject}, smalltalk.Object)})},
  744. args: ["anObject"],
  745. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  746. messageSends: ["=", "identityHash"],
  747. referencedClasses: []
  748. }),
  749. smalltalk.Object);
  750. smalltalk.addMethod(
  751. "_asJSON",
  752. smalltalk.method({
  753. selector: "asJSON",
  754. category: 'converting',
  755. fn: function (){
  756. var self=this;
  757. var variables;
  758. return smalltalk.withContext(function($ctx1) { var $1;
  759. variables=_st((smalltalk.HashedCollection || HashedCollection))._new();
  760. _st(_st(_st(self)._class())._allInstanceVariableNames())._do_((function(each){
  761. return smalltalk.withContext(function($ctx2) { return _st(variables)._at_put_(each,_st(_st(self)._instVarAt_(each))._asJSON());
  762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  763. $1=variables;
  764. return $1;
  765. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables}, smalltalk.Object)})},
  766. args: [],
  767. 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",
  768. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  769. referencedClasses: ["HashedCollection"]
  770. }),
  771. smalltalk.Object);
  772. smalltalk.addMethod(
  773. "_asJSONString",
  774. smalltalk.method({
  775. selector: "asJSONString",
  776. category: 'converting',
  777. fn: function (){
  778. var self=this;
  779. return smalltalk.withContext(function($ctx1) { var $1;
  780. $1=_st((smalltalk.JSON || JSON))._stringify_(_st(self)._asJSON());
  781. return $1;
  782. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{}, smalltalk.Object)})},
  783. args: [],
  784. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  785. messageSends: ["stringify:", "asJSON"],
  786. referencedClasses: ["JSON"]
  787. }),
  788. smalltalk.Object);
  789. smalltalk.addMethod(
  790. "_asJavascript",
  791. smalltalk.method({
  792. selector: "asJavascript",
  793. category: 'converting',
  794. fn: function (){
  795. var self=this;
  796. return smalltalk.withContext(function($ctx1) { var $1;
  797. $1=_st(self)._asString();
  798. return $1;
  799. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Object)})},
  800. args: [],
  801. source: "asJavascript\x0a\x09^self asString",
  802. messageSends: ["asString"],
  803. referencedClasses: []
  804. }),
  805. smalltalk.Object);
  806. smalltalk.addMethod(
  807. "_asString",
  808. smalltalk.method({
  809. selector: "asString",
  810. category: 'converting',
  811. fn: function (){
  812. var self=this;
  813. return smalltalk.withContext(function($ctx1) { var $1;
  814. $1=_st(self)._printString();
  815. return $1;
  816. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Object)})},
  817. args: [],
  818. source: "asString\x0a\x09^self printString",
  819. messageSends: ["printString"],
  820. referencedClasses: []
  821. }),
  822. smalltalk.Object);
  823. smalltalk.addMethod(
  824. "_basicAt_",
  825. smalltalk.method({
  826. selector: "basicAt:",
  827. category: 'accessing',
  828. fn: function (aString){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) { return self[aString];
  831. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString}, smalltalk.Object)})},
  832. args: ["aString"],
  833. source: "basicAt: aString\x0a\x09<return self[aString]>",
  834. messageSends: [],
  835. referencedClasses: []
  836. }),
  837. smalltalk.Object);
  838. smalltalk.addMethod(
  839. "_basicAt_put_",
  840. smalltalk.method({
  841. selector: "basicAt:put:",
  842. category: 'accessing',
  843. fn: function (aString,anObject){
  844. var self=this;
  845. return smalltalk.withContext(function($ctx1) { return self[aString] = anObject;
  846. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject}, smalltalk.Object)})},
  847. args: ["aString", "anObject"],
  848. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  849. messageSends: [],
  850. referencedClasses: []
  851. }),
  852. smalltalk.Object);
  853. smalltalk.addMethod(
  854. "_basicDelete_",
  855. smalltalk.method({
  856. selector: "basicDelete:",
  857. category: 'accessing',
  858. fn: function (aString){
  859. var self=this;
  860. return smalltalk.withContext(function($ctx1) { delete self[aString]; return aString;
  861. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString}, smalltalk.Object)})},
  862. args: ["aString"],
  863. source: "basicDelete: aString\x0a <delete self[aString]; return aString>",
  864. messageSends: [],
  865. referencedClasses: []
  866. }),
  867. smalltalk.Object);
  868. smalltalk.addMethod(
  869. "_basicPerform_",
  870. smalltalk.method({
  871. selector: "basicPerform:",
  872. category: 'message handling',
  873. fn: function (aSymbol){
  874. var self=this;
  875. return smalltalk.withContext(function($ctx1) { var $1;
  876. $1=_st(self)._basicPerform_withArguments_(aSymbol,[]);
  877. return $1;
  878. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aSymbol:aSymbol}, smalltalk.Object)})},
  879. args: ["aSymbol"],
  880. source: "basicPerform: aSymbol \x0a\x09^self basicPerform: aSymbol withArguments: #()",
  881. messageSends: ["basicPerform:withArguments:"],
  882. referencedClasses: []
  883. }),
  884. smalltalk.Object);
  885. smalltalk.addMethod(
  886. "_basicPerform_withArguments_",
  887. smalltalk.method({
  888. selector: "basicPerform:withArguments:",
  889. category: 'message handling',
  890. fn: function (aSymbol,aCollection){
  891. var self=this;
  892. return smalltalk.withContext(function($ctx1) { return self[aSymbol].apply(self, aCollection);;
  893. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aSymbol:aSymbol,aCollection:aCollection}, smalltalk.Object)})},
  894. args: ["aSymbol", "aCollection"],
  895. source: "basicPerform: aSymbol withArguments: aCollection\x0a\x09<return self[aSymbol].apply(self, aCollection);>",
  896. messageSends: [],
  897. referencedClasses: []
  898. }),
  899. smalltalk.Object);
  900. smalltalk.addMethod(
  901. "_class",
  902. smalltalk.method({
  903. selector: "class",
  904. category: 'accessing',
  905. fn: function (){
  906. var self=this;
  907. return smalltalk.withContext(function($ctx1) { return self.klass;
  908. return self}, function($ctx1) {$ctx1.fill(self,"class",{}, smalltalk.Object)})},
  909. args: [],
  910. source: "class\x0a\x09<return self.klass>",
  911. messageSends: [],
  912. referencedClasses: []
  913. }),
  914. smalltalk.Object);
  915. smalltalk.addMethod(
  916. "_copy",
  917. smalltalk.method({
  918. selector: "copy",
  919. category: 'copying',
  920. fn: function (){
  921. var self=this;
  922. return smalltalk.withContext(function($ctx1) { var $1;
  923. $1=_st(_st(self)._shallowCopy())._postCopy();
  924. return $1;
  925. }, function($ctx1) {$ctx1.fill(self,"copy",{}, smalltalk.Object)})},
  926. args: [],
  927. source: "copy\x0a\x09^self shallowCopy postCopy",
  928. messageSends: ["postCopy", "shallowCopy"],
  929. referencedClasses: []
  930. }),
  931. smalltalk.Object);
  932. smalltalk.addMethod(
  933. "_deepCopy",
  934. smalltalk.method({
  935. selector: "deepCopy",
  936. category: 'copying',
  937. fn: function (){
  938. var self=this;
  939. return smalltalk.withContext(function($ctx1) {
  940. var copy = self.klass._new();
  941. for(var i in self) {
  942. if(/^@.+/.test(i)) {
  943. copy[i] = self[i]._deepCopy();
  944. }
  945. }
  946. return copy;
  947. ;
  948. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Object)})},
  949. args: [],
  950. source: "deepCopy\x0a\x09< \x0a\x09 var copy = self.klass._new();\x0a\x09 for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09 copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09 }\x0a\x09 return copy;\x0a\x09>",
  951. messageSends: [],
  952. referencedClasses: []
  953. }),
  954. smalltalk.Object);
  955. smalltalk.addMethod(
  956. "_deprecatedAPI",
  957. smalltalk.method({
  958. selector: "deprecatedAPI",
  959. category: 'error handling',
  960. fn: function (){
  961. var self=this;
  962. 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(")"));
  963. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{}, smalltalk.Object)})},
  964. args: [],
  965. 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, ')'",
  966. messageSends: ["warn:", ",", "asString", "home"],
  967. referencedClasses: []
  968. }),
  969. smalltalk.Object);
  970. smalltalk.addMethod(
  971. "_doesNotUnderstand_",
  972. smalltalk.method({
  973. selector: "doesNotUnderstand:",
  974. category: 'error handling',
  975. fn: function (aMessage){
  976. var self=this;
  977. return smalltalk.withContext(function($ctx1) { var $1,$2;
  978. $1=_st((smalltalk.MessageNotUnderstood || MessageNotUnderstood))._new();
  979. _st($1)._receiver_(self);
  980. _st($1)._message_(aMessage);
  981. $2=_st($1)._signal();
  982. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage}, smalltalk.Object)})},
  983. args: ["aMessage"],
  984. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  985. messageSends: ["receiver:", "new", "message:", "signal"],
  986. referencedClasses: ["MessageNotUnderstood"]
  987. }),
  988. smalltalk.Object);
  989. smalltalk.addMethod(
  990. "_error_",
  991. smalltalk.method({
  992. selector: "error:",
  993. category: 'error handling',
  994. fn: function (aString){
  995. var self=this;
  996. return smalltalk.withContext(function($ctx1) { _st((smalltalk.Error || Error))._signal_(aString);
  997. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString}, smalltalk.Object)})},
  998. args: ["aString"],
  999. source: "error: aString\x0a\x09Error signal: aString",
  1000. messageSends: ["signal:"],
  1001. referencedClasses: ["Error"]
  1002. }),
  1003. smalltalk.Object);
  1004. smalltalk.addMethod(
  1005. "_halt",
  1006. smalltalk.method({
  1007. selector: "halt",
  1008. category: 'error handling',
  1009. fn: function (){
  1010. var self=this;
  1011. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Halt encountered");
  1012. return self}, function($ctx1) {$ctx1.fill(self,"halt",{}, smalltalk.Object)})},
  1013. args: [],
  1014. source: "halt\x0a\x09self error: 'Halt encountered'",
  1015. messageSends: ["error:"],
  1016. referencedClasses: []
  1017. }),
  1018. smalltalk.Object);
  1019. smalltalk.addMethod(
  1020. "_identityHash",
  1021. smalltalk.method({
  1022. selector: "identityHash",
  1023. category: 'accessing',
  1024. fn: function (){
  1025. var self=this;
  1026. return smalltalk.withContext(function($ctx1) {
  1027. var hash=self.identityHash;
  1028. if (hash) return hash;
  1029. hash=smalltalk.nextId();
  1030. Object.defineProperty(self, 'identityHash', {value:hash});
  1031. return hash;
  1032. ;
  1033. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{}, smalltalk.Object)})},
  1034. args: [],
  1035. 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>",
  1036. messageSends: [],
  1037. referencedClasses: []
  1038. }),
  1039. smalltalk.Object);
  1040. smalltalk.addMethod(
  1041. "_ifNil_",
  1042. smalltalk.method({
  1043. selector: "ifNil:",
  1044. category: 'testing',
  1045. fn: function (aBlock){
  1046. var self=this;
  1047. return smalltalk.withContext(function($ctx1) { var $1;
  1048. $1=self;
  1049. return $1;
  1050. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock}, smalltalk.Object)})},
  1051. args: ["aBlock"],
  1052. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  1053. messageSends: [],
  1054. referencedClasses: []
  1055. }),
  1056. smalltalk.Object);
  1057. smalltalk.addMethod(
  1058. "_ifNil_ifNotNil_",
  1059. smalltalk.method({
  1060. selector: "ifNil:ifNotNil:",
  1061. category: 'testing',
  1062. fn: function (aBlock,anotherBlock){
  1063. var self=this;
  1064. return smalltalk.withContext(function($ctx1) { var $1;
  1065. $1=_st(anotherBlock)._value();
  1066. return $1;
  1067. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Object)})},
  1068. args: ["aBlock", "anotherBlock"],
  1069. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  1070. messageSends: ["value"],
  1071. referencedClasses: []
  1072. }),
  1073. smalltalk.Object);
  1074. smalltalk.addMethod(
  1075. "_ifNotNil_",
  1076. smalltalk.method({
  1077. selector: "ifNotNil:",
  1078. category: 'testing',
  1079. fn: function (aBlock){
  1080. var self=this;
  1081. return smalltalk.withContext(function($ctx1) { var $1;
  1082. $1=_st(aBlock)._value();
  1083. return $1;
  1084. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock}, smalltalk.Object)})},
  1085. args: ["aBlock"],
  1086. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  1087. messageSends: ["value"],
  1088. referencedClasses: []
  1089. }),
  1090. smalltalk.Object);
  1091. smalltalk.addMethod(
  1092. "_ifNotNil_ifNil_",
  1093. smalltalk.method({
  1094. selector: "ifNotNil:ifNil:",
  1095. category: 'testing',
  1096. fn: function (aBlock,anotherBlock){
  1097. var self=this;
  1098. return smalltalk.withContext(function($ctx1) { var $1;
  1099. $1=_st(aBlock)._value();
  1100. return $1;
  1101. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Object)})},
  1102. args: ["aBlock", "anotherBlock"],
  1103. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  1104. messageSends: ["value"],
  1105. referencedClasses: []
  1106. }),
  1107. smalltalk.Object);
  1108. smalltalk.addMethod(
  1109. "_initialize",
  1110. smalltalk.method({
  1111. selector: "initialize",
  1112. category: 'initialization',
  1113. fn: function (){
  1114. var self=this;
  1115. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Object)})},
  1116. args: [],
  1117. source: "initialize",
  1118. messageSends: [],
  1119. referencedClasses: []
  1120. }),
  1121. smalltalk.Object);
  1122. smalltalk.addMethod(
  1123. "_instVarAt_",
  1124. smalltalk.method({
  1125. selector: "instVarAt:",
  1126. category: 'accessing',
  1127. fn: function (aSymbol){
  1128. var self=this;
  1129. return smalltalk.withContext(function($ctx1) { return self['@'+aSymbol._asString()];
  1130. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aSymbol:aSymbol}, smalltalk.Object)})},
  1131. args: ["aSymbol"],
  1132. source: "instVarAt: aSymbol\x0a\x09<return self['@'+aSymbol._asString()]>",
  1133. messageSends: [],
  1134. referencedClasses: []
  1135. }),
  1136. smalltalk.Object);
  1137. smalltalk.addMethod(
  1138. "_instVarAt_put_",
  1139. smalltalk.method({
  1140. selector: "instVarAt:put:",
  1141. category: 'accessing',
  1142. fn: function (aSymbol,anObject){
  1143. var self=this;
  1144. return smalltalk.withContext(function($ctx1) { self['@' + aSymbol._asString()] = anObject;
  1145. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aSymbol:aSymbol,anObject:anObject}, smalltalk.Object)})},
  1146. args: ["aSymbol", "anObject"],
  1147. source: "instVarAt: aSymbol put: anObject\x0a\x09<self['@' + aSymbol._asString()] = anObject>",
  1148. messageSends: [],
  1149. referencedClasses: []
  1150. }),
  1151. smalltalk.Object);
  1152. smalltalk.addMethod(
  1153. "_isBoolean",
  1154. smalltalk.method({
  1155. selector: "isBoolean",
  1156. category: 'testing',
  1157. fn: function (){
  1158. var self=this;
  1159. return smalltalk.withContext(function($ctx1) { return false;
  1160. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{}, smalltalk.Object)})},
  1161. args: [],
  1162. source: "isBoolean\x0a\x09^ false",
  1163. messageSends: [],
  1164. referencedClasses: []
  1165. }),
  1166. smalltalk.Object);
  1167. smalltalk.addMethod(
  1168. "_isClass",
  1169. smalltalk.method({
  1170. selector: "isClass",
  1171. category: 'testing',
  1172. fn: function (){
  1173. var self=this;
  1174. return smalltalk.withContext(function($ctx1) { return false;
  1175. }, function($ctx1) {$ctx1.fill(self,"isClass",{}, smalltalk.Object)})},
  1176. args: [],
  1177. source: "isClass\x0a\x09^false",
  1178. messageSends: [],
  1179. referencedClasses: []
  1180. }),
  1181. smalltalk.Object);
  1182. smalltalk.addMethod(
  1183. "_isKindOf_",
  1184. smalltalk.method({
  1185. selector: "isKindOf:",
  1186. category: 'testing',
  1187. fn: function (aClass){
  1188. var self=this;
  1189. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1190. $2=_st(self)._isMemberOf_(aClass);
  1191. if(smalltalk.assert($2)){
  1192. $1=true;
  1193. } else {
  1194. $1=_st(_st(self)._class())._inheritsFrom_(aClass);
  1195. };
  1196. return $1;
  1197. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass}, smalltalk.Object)})},
  1198. args: ["aClass"],
  1199. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: [self class inheritsFrom: aClass]",
  1200. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  1201. referencedClasses: []
  1202. }),
  1203. smalltalk.Object);
  1204. smalltalk.addMethod(
  1205. "_isMemberOf_",
  1206. smalltalk.method({
  1207. selector: "isMemberOf:",
  1208. category: 'testing',
  1209. fn: function (aClass){
  1210. var self=this;
  1211. return smalltalk.withContext(function($ctx1) { var $1;
  1212. $1=_st(_st(self)._class()).__eq(aClass);
  1213. return $1;
  1214. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass}, smalltalk.Object)})},
  1215. args: ["aClass"],
  1216. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1217. messageSends: ["=", "class"],
  1218. referencedClasses: []
  1219. }),
  1220. smalltalk.Object);
  1221. smalltalk.addMethod(
  1222. "_isMetaclass",
  1223. smalltalk.method({
  1224. selector: "isMetaclass",
  1225. category: 'testing',
  1226. fn: function (){
  1227. var self=this;
  1228. return smalltalk.withContext(function($ctx1) { return false;
  1229. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{}, smalltalk.Object)})},
  1230. args: [],
  1231. source: "isMetaclass\x0a\x09^false",
  1232. messageSends: [],
  1233. referencedClasses: []
  1234. }),
  1235. smalltalk.Object);
  1236. smalltalk.addMethod(
  1237. "_isNil",
  1238. smalltalk.method({
  1239. selector: "isNil",
  1240. category: 'testing',
  1241. fn: function (){
  1242. var self=this;
  1243. return smalltalk.withContext(function($ctx1) { return false;
  1244. }, function($ctx1) {$ctx1.fill(self,"isNil",{}, smalltalk.Object)})},
  1245. args: [],
  1246. source: "isNil\x0a\x09^false",
  1247. messageSends: [],
  1248. referencedClasses: []
  1249. }),
  1250. smalltalk.Object);
  1251. smalltalk.addMethod(
  1252. "_isNumber",
  1253. smalltalk.method({
  1254. selector: "isNumber",
  1255. category: 'testing',
  1256. fn: function (){
  1257. var self=this;
  1258. return smalltalk.withContext(function($ctx1) { return false;
  1259. }, function($ctx1) {$ctx1.fill(self,"isNumber",{}, smalltalk.Object)})},
  1260. args: [],
  1261. source: "isNumber\x0a\x09^false",
  1262. messageSends: [],
  1263. referencedClasses: []
  1264. }),
  1265. smalltalk.Object);
  1266. smalltalk.addMethod(
  1267. "_isParseFailure",
  1268. smalltalk.method({
  1269. selector: "isParseFailure",
  1270. category: 'testing',
  1271. fn: function (){
  1272. var self=this;
  1273. return smalltalk.withContext(function($ctx1) { return false;
  1274. }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{}, smalltalk.Object)})},
  1275. args: [],
  1276. source: "isParseFailure\x0a\x09^false",
  1277. messageSends: [],
  1278. referencedClasses: []
  1279. }),
  1280. smalltalk.Object);
  1281. smalltalk.addMethod(
  1282. "_isString",
  1283. smalltalk.method({
  1284. selector: "isString",
  1285. category: 'testing',
  1286. fn: function (){
  1287. var self=this;
  1288. return smalltalk.withContext(function($ctx1) { return false;
  1289. }, function($ctx1) {$ctx1.fill(self,"isString",{}, smalltalk.Object)})},
  1290. args: [],
  1291. source: "isString\x0a\x09^false",
  1292. messageSends: [],
  1293. referencedClasses: []
  1294. }),
  1295. smalltalk.Object);
  1296. smalltalk.addMethod(
  1297. "_isSymbol",
  1298. smalltalk.method({
  1299. selector: "isSymbol",
  1300. category: 'testing',
  1301. fn: function (){
  1302. var self=this;
  1303. return smalltalk.withContext(function($ctx1) { return false;
  1304. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{}, smalltalk.Object)})},
  1305. args: [],
  1306. source: "isSymbol\x0a\x09^false",
  1307. messageSends: [],
  1308. referencedClasses: []
  1309. }),
  1310. smalltalk.Object);
  1311. smalltalk.addMethod(
  1312. "_log_block_",
  1313. smalltalk.method({
  1314. selector: "log:block:",
  1315. category: 'printing',
  1316. fn: function (aString,aBlock){
  1317. var self=this;
  1318. var result;
  1319. return smalltalk.withContext(function($ctx1) { var $1;
  1320. _st(console)._log_(_st(_st(aString).__comma(" time: ")).__comma(_st(_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
  1321. return smalltalk.withContext(function($ctx2) { result=_st(aBlock)._value();
  1322. return result;
  1323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._printString()));
  1324. $1=result;
  1325. return $1;
  1326. }, function($ctx1) {$ctx1.fill(self,"log:block:",{aString:aString,aBlock:aBlock,result:result}, smalltalk.Object)})},
  1327. args: ["aString", "aBlock"],
  1328. source: "log: aString block: aBlock\x0a\x0a\x09| result |\x0a\x09console log: aString, ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.\x0a\x09^result",
  1329. messageSends: ["log:", ",", "printString", "millisecondsToRun:", "value"],
  1330. referencedClasses: ["Date"]
  1331. }),
  1332. smalltalk.Object);
  1333. smalltalk.addMethod(
  1334. "_notNil",
  1335. smalltalk.method({
  1336. selector: "notNil",
  1337. category: 'testing',
  1338. fn: function (){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) { var $1;
  1341. $1=_st(_st(self)._isNil())._not();
  1342. return $1;
  1343. }, function($ctx1) {$ctx1.fill(self,"notNil",{}, smalltalk.Object)})},
  1344. args: [],
  1345. source: "notNil\x0a\x09^self isNil not",
  1346. messageSends: ["not", "isNil"],
  1347. referencedClasses: []
  1348. }),
  1349. smalltalk.Object);
  1350. smalltalk.addMethod(
  1351. "_perform_",
  1352. smalltalk.method({
  1353. selector: "perform:",
  1354. category: 'message handling',
  1355. fn: function (aSymbol){
  1356. var self=this;
  1357. return smalltalk.withContext(function($ctx1) { var $1;
  1358. $1=_st(self)._perform_withArguments_(aSymbol,[]);
  1359. return $1;
  1360. }, function($ctx1) {$ctx1.fill(self,"perform:",{aSymbol:aSymbol}, smalltalk.Object)})},
  1361. args: ["aSymbol"],
  1362. source: "perform: aSymbol\x0a\x09^self perform: aSymbol withArguments: #()",
  1363. messageSends: ["perform:withArguments:"],
  1364. referencedClasses: []
  1365. }),
  1366. smalltalk.Object);
  1367. smalltalk.addMethod(
  1368. "_perform_withArguments_",
  1369. smalltalk.method({
  1370. selector: "perform:withArguments:",
  1371. category: 'message handling',
  1372. fn: function (aSymbol,aCollection){
  1373. var self=this;
  1374. return smalltalk.withContext(function($ctx1) { return smalltalk.send(self, aSymbol._asSelector(), aCollection);
  1375. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aSymbol:aSymbol,aCollection:aCollection}, smalltalk.Object)})},
  1376. args: ["aSymbol", "aCollection"],
  1377. source: "perform: aSymbol withArguments: aCollection\x0a\x09<return smalltalk.send(self, aSymbol._asSelector(), aCollection)>",
  1378. messageSends: [],
  1379. referencedClasses: []
  1380. }),
  1381. smalltalk.Object);
  1382. smalltalk.addMethod(
  1383. "_postCopy",
  1384. smalltalk.method({
  1385. selector: "postCopy",
  1386. category: 'copying',
  1387. fn: function (){
  1388. var self=this;
  1389. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{}, smalltalk.Object)})},
  1390. args: [],
  1391. source: "postCopy",
  1392. messageSends: [],
  1393. referencedClasses: []
  1394. }),
  1395. smalltalk.Object);
  1396. smalltalk.addMethod(
  1397. "_printNl",
  1398. smalltalk.method({
  1399. selector: "printNl",
  1400. category: 'printing',
  1401. fn: function (){
  1402. var self=this;
  1403. return smalltalk.withContext(function($ctx1) { console.log(self);
  1404. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{}, smalltalk.Object)})},
  1405. args: [],
  1406. source: "printNl\x0a\x09<console.log(self)>",
  1407. messageSends: [],
  1408. referencedClasses: []
  1409. }),
  1410. smalltalk.Object);
  1411. smalltalk.addMethod(
  1412. "_printString",
  1413. smalltalk.method({
  1414. selector: "printString",
  1415. category: 'printing',
  1416. fn: function (){
  1417. var self=this;
  1418. return smalltalk.withContext(function($ctx1) { var $1;
  1419. $1=_st("a ").__comma(_st(_st(self)._class())._name());
  1420. return $1;
  1421. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Object)})},
  1422. args: [],
  1423. source: "printString\x0a\x09^'a ', self class name",
  1424. messageSends: [",", "name", "class"],
  1425. referencedClasses: []
  1426. }),
  1427. smalltalk.Object);
  1428. smalltalk.addMethod(
  1429. "_respondsTo_",
  1430. smalltalk.method({
  1431. selector: "respondsTo:",
  1432. category: 'testing',
  1433. fn: function (aSelector){
  1434. var self=this;
  1435. return smalltalk.withContext(function($ctx1) { var $1;
  1436. $1=_st(_st(self)._class())._canUnderstand_(aSelector);
  1437. return $1;
  1438. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector}, smalltalk.Object)})},
  1439. args: ["aSelector"],
  1440. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1441. messageSends: ["canUnderstand:", "class"],
  1442. referencedClasses: []
  1443. }),
  1444. smalltalk.Object);
  1445. smalltalk.addMethod(
  1446. "_shallowCopy",
  1447. smalltalk.method({
  1448. selector: "shallowCopy",
  1449. category: 'copying',
  1450. fn: function (){
  1451. var self=this;
  1452. return smalltalk.withContext(function($ctx1) {
  1453. var copy = self.klass._new();
  1454. for(var i in self) {
  1455. if(/^@.+/.test(i)) {
  1456. copy[i] = self[i];
  1457. }
  1458. }
  1459. return copy;
  1460. ;
  1461. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.Object)})},
  1462. args: [],
  1463. source: "shallowCopy\x0a\x09<\x0a\x09 var copy = self.klass._new();\x0a\x09 for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09 copy[i] = self[i];\x0a\x09\x09}\x0a\x09 }\x0a\x09 return copy;\x0a\x09>",
  1464. messageSends: [],
  1465. referencedClasses: []
  1466. }),
  1467. smalltalk.Object);
  1468. smalltalk.addMethod(
  1469. "_shouldNotImplement",
  1470. smalltalk.method({
  1471. selector: "shouldNotImplement",
  1472. category: 'error handling',
  1473. fn: function (){
  1474. var self=this;
  1475. return smalltalk.withContext(function($ctx1) { _st(self)._error_(_st("This method should not be implemented in ").__comma(_st(_st(self)._class())._name()));
  1476. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{}, smalltalk.Object)})},
  1477. args: [],
  1478. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1479. messageSends: ["error:", ",", "name", "class"],
  1480. referencedClasses: []
  1481. }),
  1482. smalltalk.Object);
  1483. smalltalk.addMethod(
  1484. "_size",
  1485. smalltalk.method({
  1486. selector: "size",
  1487. category: 'accessing',
  1488. fn: function (){
  1489. var self=this;
  1490. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object not indexable");
  1491. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Object)})},
  1492. args: [],
  1493. source: "size\x0a\x09self error: 'Object not indexable'",
  1494. messageSends: ["error:"],
  1495. referencedClasses: []
  1496. }),
  1497. smalltalk.Object);
  1498. smalltalk.addMethod(
  1499. "_storeOn_",
  1500. smalltalk.method({
  1501. selector: "storeOn:",
  1502. category: 'printing',
  1503. fn: function (aStream){
  1504. var self=this;
  1505. return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_(_st(self)._printString());
  1506. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.Object)})},
  1507. args: ["aStream"],
  1508. source: "storeOn: aStream\x0a\x09aStream nextPutAll: self printString",
  1509. messageSends: ["nextPutAll:", "printString"],
  1510. referencedClasses: []
  1511. }),
  1512. smalltalk.Object);
  1513. smalltalk.addMethod(
  1514. "_storeString",
  1515. smalltalk.method({
  1516. selector: "storeString",
  1517. category: 'printing',
  1518. fn: function (){
  1519. var self=this;
  1520. return smalltalk.withContext(function($ctx1) { var $1;
  1521. $1=_st((smalltalk.String || String))._streamContents_((function(s){
  1522. return smalltalk.withContext(function($ctx2) { return _st(self)._storeOn_(s);
  1523. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1)})}));
  1524. return $1;
  1525. }, function($ctx1) {$ctx1.fill(self,"storeString",{}, smalltalk.Object)})},
  1526. args: [],
  1527. source: "storeString\x0a\x09\x22Answer a String representation of the receiver from which the receiver \x0a\x09can be reconstructed.\x22\x0a\x0a\x09^ String streamContents: [:s | self storeOn: s]",
  1528. messageSends: ["streamContents:", "storeOn:"],
  1529. referencedClasses: ["String"]
  1530. }),
  1531. smalltalk.Object);
  1532. smalltalk.addMethod(
  1533. "_subclassResponsibility",
  1534. smalltalk.method({
  1535. selector: "subclassResponsibility",
  1536. category: 'error handling',
  1537. fn: function (){
  1538. var self=this;
  1539. return smalltalk.withContext(function($ctx1) { _st(self)._error_("This method is a responsibility of a subclass");
  1540. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{}, smalltalk.Object)})},
  1541. args: [],
  1542. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1543. messageSends: ["error:"],
  1544. referencedClasses: []
  1545. }),
  1546. smalltalk.Object);
  1547. smalltalk.addMethod(
  1548. "_test",
  1549. smalltalk.method({
  1550. selector: "test",
  1551. category: 'converting',
  1552. fn: function (){
  1553. var self=this;
  1554. var a;
  1555. return smalltalk.withContext(function($ctx1) { a=(1);
  1556. _st(self)._halt();
  1557. return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a}, smalltalk.Object)})},
  1558. args: [],
  1559. source: "test\x0a\x09| a |\x0a a := 1.\x0a self halt",
  1560. messageSends: ["halt"],
  1561. referencedClasses: []
  1562. }),
  1563. smalltalk.Object);
  1564. smalltalk.addMethod(
  1565. "_throw_",
  1566. smalltalk.method({
  1567. selector: "throw:",
  1568. category: 'error handling',
  1569. fn: function (anObject){
  1570. var self=this;
  1571. return smalltalk.withContext(function($ctx1) { throw anObject ;
  1572. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject}, smalltalk.Object)})},
  1573. args: ["anObject"],
  1574. source: "throw: anObject\x0a\x09< throw anObject >",
  1575. messageSends: [],
  1576. referencedClasses: []
  1577. }),
  1578. smalltalk.Object);
  1579. smalltalk.addMethod(
  1580. "_try_catch_",
  1581. smalltalk.method({
  1582. selector: "try:catch:",
  1583. category: 'error handling',
  1584. fn: function (aBlock,anotherBlock){
  1585. var self=this;
  1586. return smalltalk.withContext(function($ctx1) { try{return aBlock()} catch(e) {return anotherBlock(e)};
  1587. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Object)})},
  1588. args: ["aBlock", "anotherBlock"],
  1589. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock()} catch(e) {return anotherBlock(e)}>",
  1590. messageSends: [],
  1591. referencedClasses: []
  1592. }),
  1593. smalltalk.Object);
  1594. smalltalk.addMethod(
  1595. "_value",
  1596. smalltalk.method({
  1597. selector: "value",
  1598. category: 'accessing',
  1599. fn: function (){
  1600. var self=this;
  1601. return smalltalk.withContext(function($ctx1) { return self.valueOf();
  1602. return self}, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.Object)})},
  1603. args: [],
  1604. source: "value\x0a\x09<return self.valueOf()>",
  1605. messageSends: [],
  1606. referencedClasses: []
  1607. }),
  1608. smalltalk.Object);
  1609. smalltalk.addMethod(
  1610. "_yourself",
  1611. smalltalk.method({
  1612. selector: "yourself",
  1613. category: 'accessing',
  1614. fn: function (){
  1615. var self=this;
  1616. return smalltalk.withContext(function($ctx1) { var $1;
  1617. $1=self;
  1618. return $1;
  1619. }, function($ctx1) {$ctx1.fill(self,"yourself",{}, smalltalk.Object)})},
  1620. args: [],
  1621. source: "yourself\x0a\x09^self",
  1622. messageSends: [],
  1623. referencedClasses: []
  1624. }),
  1625. smalltalk.Object);
  1626. smalltalk.addMethod(
  1627. "__tild_eq",
  1628. smalltalk.method({
  1629. selector: "~=",
  1630. category: 'comparing',
  1631. fn: function (anObject){
  1632. var self=this;
  1633. return smalltalk.withContext(function($ctx1) { var $1;
  1634. $1=_st(_st(self).__eq(anObject)).__eq(false);
  1635. return $1;
  1636. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject}, smalltalk.Object)})},
  1637. args: ["anObject"],
  1638. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1639. messageSends: ["="],
  1640. referencedClasses: []
  1641. }),
  1642. smalltalk.Object);
  1643. smalltalk.addMethod(
  1644. "__tild_tild",
  1645. smalltalk.method({
  1646. selector: "~~",
  1647. category: 'comparing',
  1648. fn: function (anObject){
  1649. var self=this;
  1650. return smalltalk.withContext(function($ctx1) { var $1;
  1651. $1=_st(_st(self).__eq_eq(anObject)).__eq(false);
  1652. return $1;
  1653. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject}, smalltalk.Object)})},
  1654. args: ["anObject"],
  1655. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1656. messageSends: ["=", "=="],
  1657. referencedClasses: []
  1658. }),
  1659. smalltalk.Object);
  1660. smalltalk.addMethod(
  1661. "_initialize",
  1662. smalltalk.method({
  1663. selector: "initialize",
  1664. category: 'initialization',
  1665. fn: function (){
  1666. var self=this;
  1667. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Object.klass)})},
  1668. args: [],
  1669. source: "initialize\x0a\x09\x22no op\x22",
  1670. messageSends: [],
  1671. referencedClasses: []
  1672. }),
  1673. smalltalk.Object.klass);
  1674. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1675. smalltalk.Boolean.comment="Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0aBoolean defines the protocol for logic testing operations and conditional control structures for the logical values.\x0aBoolean instances are weither `true` or `false`."
  1676. smalltalk.addMethod(
  1677. "__and",
  1678. smalltalk.method({
  1679. selector: "&",
  1680. category: 'controlling',
  1681. fn: function (aBoolean){
  1682. var self=this;
  1683. return smalltalk.withContext(function($ctx1) {
  1684. if(self == true) {
  1685. return aBoolean;
  1686. } else {
  1687. return false;
  1688. }
  1689. ;
  1690. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean}, smalltalk.Boolean)})},
  1691. args: ["aBoolean"],
  1692. source: "& aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09 } else {\x0a\x09\x09return false;\x0a\x09 }\x0a\x09>",
  1693. messageSends: [],
  1694. referencedClasses: []
  1695. }),
  1696. smalltalk.Boolean);
  1697. smalltalk.addMethod(
  1698. "__eq",
  1699. smalltalk.method({
  1700. selector: "=",
  1701. category: 'comparing',
  1702. fn: function (aBoolean){
  1703. var self=this;
  1704. return smalltalk.withContext(function($ctx1) {
  1705. if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
  1706. return false;
  1707. }
  1708. return Boolean(self == true) == aBoolean
  1709. ;
  1710. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean}, smalltalk.Boolean)})},
  1711. args: ["aBoolean"],
  1712. source: "= aBoolean\x0a\x09<\x0a \x09if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {\x0a \x09return false;\x0a }\x0a \x09return Boolean(self == true) == aBoolean\x0a >",
  1713. messageSends: [],
  1714. referencedClasses: []
  1715. }),
  1716. smalltalk.Boolean);
  1717. smalltalk.addMethod(
  1718. "__eq_eq",
  1719. smalltalk.method({
  1720. selector: "==",
  1721. category: 'comparing',
  1722. fn: function (aBoolean){
  1723. var self=this;
  1724. return smalltalk.withContext(function($ctx1) { var $1;
  1725. $1=_st(self).__eq(aBoolean);
  1726. return $1;
  1727. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean}, smalltalk.Boolean)})},
  1728. args: ["aBoolean"],
  1729. source: "== aBoolean\x0a\x09^self = aBoolean",
  1730. messageSends: ["="],
  1731. referencedClasses: []
  1732. }),
  1733. smalltalk.Boolean);
  1734. smalltalk.addMethod(
  1735. "_and_",
  1736. smalltalk.method({
  1737. selector: "and:",
  1738. category: 'controlling',
  1739. fn: function (aBlock){
  1740. var self=this;
  1741. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1742. $2=_st(self).__eq(true);
  1743. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1744. return smalltalk.withContext(function($ctx2) { return false;
  1745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1746. return $1;
  1747. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock}, smalltalk.Boolean)})},
  1748. args: ["aBlock"],
  1749. source: "and: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: aBlock\x0a\x09 ifFalse: [false]",
  1750. messageSends: ["ifTrue:ifFalse:", "="],
  1751. referencedClasses: []
  1752. }),
  1753. smalltalk.Boolean);
  1754. smalltalk.addMethod(
  1755. "_asJSON",
  1756. smalltalk.method({
  1757. selector: "asJSON",
  1758. category: 'converting',
  1759. fn: function (){
  1760. var self=this;
  1761. return smalltalk.withContext(function($ctx1) { var $1;
  1762. $1=self;
  1763. return $1;
  1764. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Boolean)})},
  1765. args: [],
  1766. source: "asJSON\x0a\x09^self",
  1767. messageSends: [],
  1768. referencedClasses: []
  1769. }),
  1770. smalltalk.Boolean);
  1771. smalltalk.addMethod(
  1772. "_deepCopy",
  1773. smalltalk.method({
  1774. selector: "deepCopy",
  1775. category: 'copying',
  1776. fn: function (){
  1777. var self=this;
  1778. return smalltalk.withContext(function($ctx1) { var $1;
  1779. $1=self;
  1780. return $1;
  1781. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Boolean)})},
  1782. args: [],
  1783. source: "deepCopy\x0a\x09^self",
  1784. messageSends: [],
  1785. referencedClasses: []
  1786. }),
  1787. smalltalk.Boolean);
  1788. smalltalk.addMethod(
  1789. "_ifFalse_",
  1790. smalltalk.method({
  1791. selector: "ifFalse:",
  1792. category: 'controlling',
  1793. fn: function (aBlock){
  1794. var self=this;
  1795. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1796. $2=self;
  1797. $1=_st($2)._ifTrue_ifFalse_((function(){
  1798. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1799. return $1;
  1800. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock}, smalltalk.Boolean)})},
  1801. args: ["aBlock"],
  1802. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1803. messageSends: ["ifTrue:ifFalse:"],
  1804. referencedClasses: []
  1805. }),
  1806. smalltalk.Boolean);
  1807. smalltalk.addMethod(
  1808. "_ifFalse_ifTrue_",
  1809. smalltalk.method({
  1810. selector: "ifFalse:ifTrue:",
  1811. category: 'controlling',
  1812. fn: function (aBlock,anotherBlock){
  1813. var self=this;
  1814. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1815. $2=self;
  1816. $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
  1817. return $1;
  1818. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Boolean)})},
  1819. args: ["aBlock", "anotherBlock"],
  1820. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1821. messageSends: ["ifTrue:ifFalse:"],
  1822. referencedClasses: []
  1823. }),
  1824. smalltalk.Boolean);
  1825. smalltalk.addMethod(
  1826. "_ifTrue_",
  1827. smalltalk.method({
  1828. selector: "ifTrue:",
  1829. category: 'controlling',
  1830. fn: function (aBlock){
  1831. var self=this;
  1832. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1833. $2=self;
  1834. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1835. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1836. return $1;
  1837. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock}, smalltalk.Boolean)})},
  1838. args: ["aBlock"],
  1839. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1840. messageSends: ["ifTrue:ifFalse:"],
  1841. referencedClasses: []
  1842. }),
  1843. smalltalk.Boolean);
  1844. smalltalk.addMethod(
  1845. "_ifTrue_ifFalse_",
  1846. smalltalk.method({
  1847. selector: "ifTrue:ifFalse:",
  1848. category: 'controlling',
  1849. fn: function (aBlock,anotherBlock){
  1850. var self=this;
  1851. return smalltalk.withContext(function($ctx1) {
  1852. if(self == true) {
  1853. return aBlock();
  1854. } else {
  1855. return anotherBlock();
  1856. }
  1857. ;
  1858. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Boolean)})},
  1859. args: ["aBlock", "anotherBlock"],
  1860. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBlock();\x0a\x09 } else {\x0a\x09\x09return anotherBlock();\x0a\x09 }\x0a\x09>",
  1861. messageSends: [],
  1862. referencedClasses: []
  1863. }),
  1864. smalltalk.Boolean);
  1865. smalltalk.addMethod(
  1866. "_isBoolean",
  1867. smalltalk.method({
  1868. selector: "isBoolean",
  1869. category: 'testing',
  1870. fn: function (){
  1871. var self=this;
  1872. return smalltalk.withContext(function($ctx1) { return true;
  1873. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{}, smalltalk.Boolean)})},
  1874. args: [],
  1875. source: "isBoolean\x0a\x09^ true",
  1876. messageSends: [],
  1877. referencedClasses: []
  1878. }),
  1879. smalltalk.Boolean);
  1880. smalltalk.addMethod(
  1881. "_not",
  1882. smalltalk.method({
  1883. selector: "not",
  1884. category: 'controlling',
  1885. fn: function (){
  1886. var self=this;
  1887. return smalltalk.withContext(function($ctx1) { var $1;
  1888. $1=_st(self).__eq(false);
  1889. return $1;
  1890. }, function($ctx1) {$ctx1.fill(self,"not",{}, smalltalk.Boolean)})},
  1891. args: [],
  1892. source: "not\x0a\x09^self = false",
  1893. messageSends: ["="],
  1894. referencedClasses: []
  1895. }),
  1896. smalltalk.Boolean);
  1897. smalltalk.addMethod(
  1898. "_or_",
  1899. smalltalk.method({
  1900. selector: "or:",
  1901. category: 'controlling',
  1902. fn: function (aBlock){
  1903. var self=this;
  1904. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1905. $2=_st(self).__eq(true);
  1906. $1=_st($2)._ifTrue_ifFalse_((function(){
  1907. return smalltalk.withContext(function($ctx2) { return true;
  1908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1909. return $1;
  1910. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock}, smalltalk.Boolean)})},
  1911. args: ["aBlock"],
  1912. source: "or: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: aBlock",
  1913. messageSends: ["ifTrue:ifFalse:", "="],
  1914. referencedClasses: []
  1915. }),
  1916. smalltalk.Boolean);
  1917. smalltalk.addMethod(
  1918. "_printString",
  1919. smalltalk.method({
  1920. selector: "printString",
  1921. category: 'printing',
  1922. fn: function (){
  1923. var self=this;
  1924. return smalltalk.withContext(function($ctx1) { return self.toString();
  1925. return self}, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Boolean)})},
  1926. args: [],
  1927. source: "printString\x0a\x09<return self.toString()>",
  1928. messageSends: [],
  1929. referencedClasses: []
  1930. }),
  1931. smalltalk.Boolean);
  1932. smalltalk.addMethod(
  1933. "_shallowCopy",
  1934. smalltalk.method({
  1935. selector: "shallowCopy",
  1936. category: 'copying',
  1937. fn: function (){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) { var $1;
  1940. $1=self;
  1941. return $1;
  1942. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.Boolean)})},
  1943. args: [],
  1944. source: "shallowCopy\x0a\x09^self",
  1945. messageSends: [],
  1946. referencedClasses: []
  1947. }),
  1948. smalltalk.Boolean);
  1949. smalltalk.addMethod(
  1950. "__or",
  1951. smalltalk.method({
  1952. selector: "|",
  1953. category: 'controlling',
  1954. fn: function (aBoolean){
  1955. var self=this;
  1956. return smalltalk.withContext(function($ctx1) {
  1957. if(self == true) {
  1958. return true;
  1959. } else {
  1960. return aBoolean;
  1961. }
  1962. ;
  1963. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean}, smalltalk.Boolean)})},
  1964. args: ["aBoolean"],
  1965. source: "| aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return true;\x0a\x09 } else {\x0a\x09\x09return aBoolean;\x0a\x09 }\x0a\x09>",
  1966. messageSends: [],
  1967. referencedClasses: []
  1968. }),
  1969. smalltalk.Boolean);
  1970. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1971. smalltalk.Date.comment="The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects."
  1972. smalltalk.addMethod(
  1973. "__plus",
  1974. smalltalk.method({
  1975. selector: "+",
  1976. category: 'arithmetic',
  1977. fn: function (aDate){
  1978. var self=this;
  1979. return smalltalk.withContext(function($ctx1) { return self + aDate;
  1980. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate}, smalltalk.Date)})},
  1981. args: ["aDate"],
  1982. source: "+ aDate\x0a\x09<return self + aDate>",
  1983. messageSends: [],
  1984. referencedClasses: []
  1985. }),
  1986. smalltalk.Date);
  1987. smalltalk.addMethod(
  1988. "__minus",
  1989. smalltalk.method({
  1990. selector: "-",
  1991. category: 'arithmetic',
  1992. fn: function (aDate){
  1993. var self=this;
  1994. return smalltalk.withContext(function($ctx1) { return self - aDate;
  1995. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate}, smalltalk.Date)})},
  1996. args: ["aDate"],
  1997. source: "- aDate\x0a\x09<return self - aDate>",
  1998. messageSends: [],
  1999. referencedClasses: []
  2000. }),
  2001. smalltalk.Date);
  2002. smalltalk.addMethod(
  2003. "__lt",
  2004. smalltalk.method({
  2005. selector: "<",
  2006. category: 'comparing',
  2007. fn: function (aDate){
  2008. var self=this;
  2009. return smalltalk.withContext(function($ctx1) { return self < aDate;
  2010. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate}, smalltalk.Date)})},
  2011. args: ["aDate"],
  2012. source: "< aDate\x0a\x09<return self < aDate>",
  2013. messageSends: [],
  2014. referencedClasses: []
  2015. }),
  2016. smalltalk.Date);
  2017. smalltalk.addMethod(
  2018. "__lt_eq",
  2019. smalltalk.method({
  2020. selector: "<=",
  2021. category: 'comparing',
  2022. fn: function (aDate){
  2023. var self=this;
  2024. return smalltalk.withContext(function($ctx1) { return self <= aDate;
  2025. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate}, smalltalk.Date)})},
  2026. args: ["aDate"],
  2027. source: "<= aDate\x0a\x09<return self <= aDate>",
  2028. messageSends: [],
  2029. referencedClasses: []
  2030. }),
  2031. smalltalk.Date);
  2032. smalltalk.addMethod(
  2033. "__gt",
  2034. smalltalk.method({
  2035. selector: ">",
  2036. category: 'comparing',
  2037. fn: function (aDate){
  2038. var self=this;
  2039. return smalltalk.withContext(function($ctx1) { return self > aDate;
  2040. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate}, smalltalk.Date)})},
  2041. args: ["aDate"],
  2042. source: "> aDate\x0a\x09<return self >> aDate>",
  2043. messageSends: [],
  2044. referencedClasses: []
  2045. }),
  2046. smalltalk.Date);
  2047. smalltalk.addMethod(
  2048. "__gt_eq",
  2049. smalltalk.method({
  2050. selector: ">=",
  2051. category: 'comparing',
  2052. fn: function (aDate){
  2053. var self=this;
  2054. return smalltalk.withContext(function($ctx1) { return self >= aDate;
  2055. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate}, smalltalk.Date)})},
  2056. args: ["aDate"],
  2057. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2058. messageSends: [],
  2059. referencedClasses: []
  2060. }),
  2061. smalltalk.Date);
  2062. smalltalk.addMethod(
  2063. "_asDateString",
  2064. smalltalk.method({
  2065. selector: "asDateString",
  2066. category: 'converting',
  2067. fn: function (){
  2068. var self=this;
  2069. return smalltalk.withContext(function($ctx1) { return self.toDateString();
  2070. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{}, smalltalk.Date)})},
  2071. args: [],
  2072. source: "asDateString\x0a\x09<return self.toDateString()>",
  2073. messageSends: [],
  2074. referencedClasses: []
  2075. }),
  2076. smalltalk.Date);
  2077. smalltalk.addMethod(
  2078. "_asLocaleString",
  2079. smalltalk.method({
  2080. selector: "asLocaleString",
  2081. category: 'converting',
  2082. fn: function (){
  2083. var self=this;
  2084. return smalltalk.withContext(function($ctx1) { return self.toLocaleString();
  2085. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{}, smalltalk.Date)})},
  2086. args: [],
  2087. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2088. messageSends: [],
  2089. referencedClasses: []
  2090. }),
  2091. smalltalk.Date);
  2092. smalltalk.addMethod(
  2093. "_asMilliseconds",
  2094. smalltalk.method({
  2095. selector: "asMilliseconds",
  2096. category: 'converting',
  2097. fn: function (){
  2098. var self=this;
  2099. return smalltalk.withContext(function($ctx1) { var $1;
  2100. $1=_st(self)._time();
  2101. return $1;
  2102. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{}, smalltalk.Date)})},
  2103. args: [],
  2104. source: "asMilliseconds\x0a\x09^self time",
  2105. messageSends: ["time"],
  2106. referencedClasses: []
  2107. }),
  2108. smalltalk.Date);
  2109. smalltalk.addMethod(
  2110. "_asNumber",
  2111. smalltalk.method({
  2112. selector: "asNumber",
  2113. category: 'converting',
  2114. fn: function (){
  2115. var self=this;
  2116. return smalltalk.withContext(function($ctx1) { var $1;
  2117. $1=_st(self)._asMilliseconds();
  2118. return $1;
  2119. }, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.Date)})},
  2120. args: [],
  2121. source: "asNumber\x0a\x09^self asMilliseconds",
  2122. messageSends: ["asMilliseconds"],
  2123. referencedClasses: []
  2124. }),
  2125. smalltalk.Date);
  2126. smalltalk.addMethod(
  2127. "_asString",
  2128. smalltalk.method({
  2129. selector: "asString",
  2130. category: 'converting',
  2131. fn: function (){
  2132. var self=this;
  2133. return smalltalk.withContext(function($ctx1) { return self.toString();
  2134. return self}, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Date)})},
  2135. args: [],
  2136. source: "asString\x0a\x09<return self.toString()>",
  2137. messageSends: [],
  2138. referencedClasses: []
  2139. }),
  2140. smalltalk.Date);
  2141. smalltalk.addMethod(
  2142. "_asTimeString",
  2143. smalltalk.method({
  2144. selector: "asTimeString",
  2145. category: 'converting',
  2146. fn: function (){
  2147. var self=this;
  2148. return smalltalk.withContext(function($ctx1) { return self.toTimeString();
  2149. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{}, smalltalk.Date)})},
  2150. args: [],
  2151. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2152. messageSends: [],
  2153. referencedClasses: []
  2154. }),
  2155. smalltalk.Date);
  2156. smalltalk.addMethod(
  2157. "_day",
  2158. smalltalk.method({
  2159. selector: "day",
  2160. category: 'accessing',
  2161. fn: function (){
  2162. var self=this;
  2163. return smalltalk.withContext(function($ctx1) { var $1;
  2164. $1=_st(self)._dayOfWeek();
  2165. return $1;
  2166. }, function($ctx1) {$ctx1.fill(self,"day",{}, smalltalk.Date)})},
  2167. args: [],
  2168. source: "day\x0a\x09^self dayOfWeek",
  2169. messageSends: ["dayOfWeek"],
  2170. referencedClasses: []
  2171. }),
  2172. smalltalk.Date);
  2173. smalltalk.addMethod(
  2174. "_day_",
  2175. smalltalk.method({
  2176. selector: "day:",
  2177. category: 'accessing',
  2178. fn: function (aNumber){
  2179. var self=this;
  2180. return smalltalk.withContext(function($ctx1) { _st(self)._dayOfWeek_(aNumber);
  2181. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber}, smalltalk.Date)})},
  2182. args: ["aNumber"],
  2183. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2184. messageSends: ["dayOfWeek:"],
  2185. referencedClasses: []
  2186. }),
  2187. smalltalk.Date);
  2188. smalltalk.addMethod(
  2189. "_dayOfMonth",
  2190. smalltalk.method({
  2191. selector: "dayOfMonth",
  2192. category: 'accessing',
  2193. fn: function (){
  2194. var self=this;
  2195. return smalltalk.withContext(function($ctx1) { return self.getDate();
  2196. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{}, smalltalk.Date)})},
  2197. args: [],
  2198. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2199. messageSends: [],
  2200. referencedClasses: []
  2201. }),
  2202. smalltalk.Date);
  2203. smalltalk.addMethod(
  2204. "_dayOfMonth_",
  2205. smalltalk.method({
  2206. selector: "dayOfMonth:",
  2207. category: 'accessing',
  2208. fn: function (aNumber){
  2209. var self=this;
  2210. return smalltalk.withContext(function($ctx1) { self.setDate(aNumber);
  2211. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber}, smalltalk.Date)})},
  2212. args: ["aNumber"],
  2213. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2214. messageSends: [],
  2215. referencedClasses: []
  2216. }),
  2217. smalltalk.Date);
  2218. smalltalk.addMethod(
  2219. "_dayOfWeek",
  2220. smalltalk.method({
  2221. selector: "dayOfWeek",
  2222. category: 'accessing',
  2223. fn: function (){
  2224. var self=this;
  2225. return smalltalk.withContext(function($ctx1) { return self.getDay() + 1;
  2226. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{}, smalltalk.Date)})},
  2227. args: [],
  2228. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2229. messageSends: [],
  2230. referencedClasses: []
  2231. }),
  2232. smalltalk.Date);
  2233. smalltalk.addMethod(
  2234. "_dayOfWeek_",
  2235. smalltalk.method({
  2236. selector: "dayOfWeek:",
  2237. category: 'accessing',
  2238. fn: function (aNumber){
  2239. var self=this;
  2240. return smalltalk.withContext(function($ctx1) { return self.setDay(aNumber - 1);
  2241. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber}, smalltalk.Date)})},
  2242. args: ["aNumber"],
  2243. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2244. messageSends: [],
  2245. referencedClasses: []
  2246. }),
  2247. smalltalk.Date);
  2248. smalltalk.addMethod(
  2249. "_hours",
  2250. smalltalk.method({
  2251. selector: "hours",
  2252. category: 'accessing',
  2253. fn: function (){
  2254. var self=this;
  2255. return smalltalk.withContext(function($ctx1) { return self.getHours();
  2256. return self}, function($ctx1) {$ctx1.fill(self,"hours",{}, smalltalk.Date)})},
  2257. args: [],
  2258. source: "hours\x0a\x09<return self.getHours()>",
  2259. messageSends: [],
  2260. referencedClasses: []
  2261. }),
  2262. smalltalk.Date);
  2263. smalltalk.addMethod(
  2264. "_hours_",
  2265. smalltalk.method({
  2266. selector: "hours:",
  2267. category: 'accessing',
  2268. fn: function (aNumber){
  2269. var self=this;
  2270. return smalltalk.withContext(function($ctx1) { self.setHours(aNumber);
  2271. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber}, smalltalk.Date)})},
  2272. args: ["aNumber"],
  2273. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2274. messageSends: [],
  2275. referencedClasses: []
  2276. }),
  2277. smalltalk.Date);
  2278. smalltalk.addMethod(
  2279. "_milliseconds",
  2280. smalltalk.method({
  2281. selector: "milliseconds",
  2282. category: 'accessing',
  2283. fn: function (){
  2284. var self=this;
  2285. return smalltalk.withContext(function($ctx1) { return self.getMilliseconds();
  2286. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{}, smalltalk.Date)})},
  2287. args: [],
  2288. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2289. messageSends: [],
  2290. referencedClasses: []
  2291. }),
  2292. smalltalk.Date);
  2293. smalltalk.addMethod(
  2294. "_milliseconds_",
  2295. smalltalk.method({
  2296. selector: "milliseconds:",
  2297. category: 'accessing',
  2298. fn: function (aNumber){
  2299. var self=this;
  2300. return smalltalk.withContext(function($ctx1) { self.setMilliseconds(aNumber);
  2301. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber}, smalltalk.Date)})},
  2302. args: ["aNumber"],
  2303. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2304. messageSends: [],
  2305. referencedClasses: []
  2306. }),
  2307. smalltalk.Date);
  2308. smalltalk.addMethod(
  2309. "_minutes",
  2310. smalltalk.method({
  2311. selector: "minutes",
  2312. category: 'accessing',
  2313. fn: function (){
  2314. var self=this;
  2315. return smalltalk.withContext(function($ctx1) { return self.getMinutes();
  2316. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{}, smalltalk.Date)})},
  2317. args: [],
  2318. source: "minutes\x0a\x09<return self.getMinutes()>",
  2319. messageSends: [],
  2320. referencedClasses: []
  2321. }),
  2322. smalltalk.Date);
  2323. smalltalk.addMethod(
  2324. "_minutes_",
  2325. smalltalk.method({
  2326. selector: "minutes:",
  2327. category: 'accessing',
  2328. fn: function (aNumber){
  2329. var self=this;
  2330. return smalltalk.withContext(function($ctx1) { self.setMinutes(aNumber);
  2331. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber}, smalltalk.Date)})},
  2332. args: ["aNumber"],
  2333. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2334. messageSends: [],
  2335. referencedClasses: []
  2336. }),
  2337. smalltalk.Date);
  2338. smalltalk.addMethod(
  2339. "_month",
  2340. smalltalk.method({
  2341. selector: "month",
  2342. category: 'accessing',
  2343. fn: function (){
  2344. var self=this;
  2345. return smalltalk.withContext(function($ctx1) { return self.getMonth() + 1;
  2346. return self}, function($ctx1) {$ctx1.fill(self,"month",{}, smalltalk.Date)})},
  2347. args: [],
  2348. source: "month\x0a\x09<return self.getMonth() + 1>",
  2349. messageSends: [],
  2350. referencedClasses: []
  2351. }),
  2352. smalltalk.Date);
  2353. smalltalk.addMethod(
  2354. "_month_",
  2355. smalltalk.method({
  2356. selector: "month:",
  2357. category: 'accessing',
  2358. fn: function (aNumber){
  2359. var self=this;
  2360. return smalltalk.withContext(function($ctx1) { self.setMonth(aNumber - 1);
  2361. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber}, smalltalk.Date)})},
  2362. args: ["aNumber"],
  2363. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2364. messageSends: [],
  2365. referencedClasses: []
  2366. }),
  2367. smalltalk.Date);
  2368. smalltalk.addMethod(
  2369. "_printString",
  2370. smalltalk.method({
  2371. selector: "printString",
  2372. category: 'printing',
  2373. fn: function (){
  2374. var self=this;
  2375. return smalltalk.withContext(function($ctx1) { var $1;
  2376. $1=_st(self)._asString();
  2377. return $1;
  2378. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Date)})},
  2379. args: [],
  2380. source: "printString\x0a\x09^self asString",
  2381. messageSends: ["asString"],
  2382. referencedClasses: []
  2383. }),
  2384. smalltalk.Date);
  2385. smalltalk.addMethod(
  2386. "_seconds",
  2387. smalltalk.method({
  2388. selector: "seconds",
  2389. category: 'accessing',
  2390. fn: function (){
  2391. var self=this;
  2392. return smalltalk.withContext(function($ctx1) { return self.getSeconds();
  2393. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{}, smalltalk.Date)})},
  2394. args: [],
  2395. source: "seconds\x0a\x09<return self.getSeconds()>",
  2396. messageSends: [],
  2397. referencedClasses: []
  2398. }),
  2399. smalltalk.Date);
  2400. smalltalk.addMethod(
  2401. "_seconds_",
  2402. smalltalk.method({
  2403. selector: "seconds:",
  2404. category: 'accessing',
  2405. fn: function (aNumber){
  2406. var self=this;
  2407. return smalltalk.withContext(function($ctx1) { self.setSeconds(aNumber);
  2408. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber}, smalltalk.Date)})},
  2409. args: ["aNumber"],
  2410. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2411. messageSends: [],
  2412. referencedClasses: []
  2413. }),
  2414. smalltalk.Date);
  2415. smalltalk.addMethod(
  2416. "_time",
  2417. smalltalk.method({
  2418. selector: "time",
  2419. category: 'accessing',
  2420. fn: function (){
  2421. var self=this;
  2422. return smalltalk.withContext(function($ctx1) { return self.getTime();
  2423. return self}, function($ctx1) {$ctx1.fill(self,"time",{}, smalltalk.Date)})},
  2424. args: [],
  2425. source: "time\x0a\x09<return self.getTime()>",
  2426. messageSends: [],
  2427. referencedClasses: []
  2428. }),
  2429. smalltalk.Date);
  2430. smalltalk.addMethod(
  2431. "_time_",
  2432. smalltalk.method({
  2433. selector: "time:",
  2434. category: 'accessing',
  2435. fn: function (aNumber){
  2436. var self=this;
  2437. return smalltalk.withContext(function($ctx1) { self.setTime(aNumber);
  2438. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber}, smalltalk.Date)})},
  2439. args: ["aNumber"],
  2440. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2441. messageSends: [],
  2442. referencedClasses: []
  2443. }),
  2444. smalltalk.Date);
  2445. smalltalk.addMethod(
  2446. "_year",
  2447. smalltalk.method({
  2448. selector: "year",
  2449. category: 'accessing',
  2450. fn: function (){
  2451. var self=this;
  2452. return smalltalk.withContext(function($ctx1) { return self.getFullYear();
  2453. return self}, function($ctx1) {$ctx1.fill(self,"year",{}, smalltalk.Date)})},
  2454. args: [],
  2455. source: "year\x0a\x09<return self.getFullYear()>",
  2456. messageSends: [],
  2457. referencedClasses: []
  2458. }),
  2459. smalltalk.Date);
  2460. smalltalk.addMethod(
  2461. "_year_",
  2462. smalltalk.method({
  2463. selector: "year:",
  2464. category: 'accessing',
  2465. fn: function (aNumber){
  2466. var self=this;
  2467. return smalltalk.withContext(function($ctx1) { self.setFullYear(aNumber);
  2468. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber}, smalltalk.Date)})},
  2469. args: ["aNumber"],
  2470. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2471. messageSends: [],
  2472. referencedClasses: []
  2473. }),
  2474. smalltalk.Date);
  2475. smalltalk.addMethod(
  2476. "_fromMilliseconds_",
  2477. smalltalk.method({
  2478. selector: "fromMilliseconds:",
  2479. category: 'instance creation',
  2480. fn: function (aNumber){
  2481. var self=this;
  2482. return smalltalk.withContext(function($ctx1) { var $1;
  2483. $1=_st(self)._new_(aNumber);
  2484. return $1;
  2485. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber}, smalltalk.Date.klass)})},
  2486. args: ["aNumber"],
  2487. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2488. messageSends: ["new:"],
  2489. referencedClasses: []
  2490. }),
  2491. smalltalk.Date.klass);
  2492. smalltalk.addMethod(
  2493. "_fromSeconds_",
  2494. smalltalk.method({
  2495. selector: "fromSeconds:",
  2496. category: 'instance creation',
  2497. fn: function (aNumber){
  2498. var self=this;
  2499. return smalltalk.withContext(function($ctx1) { var $1;
  2500. $1=_st(self)._fromMilliseconds_(_st(aNumber).__star((1000)));
  2501. return $1;
  2502. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber}, smalltalk.Date.klass)})},
  2503. args: ["aNumber"],
  2504. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2505. messageSends: ["fromMilliseconds:", "*"],
  2506. referencedClasses: []
  2507. }),
  2508. smalltalk.Date.klass);
  2509. smalltalk.addMethod(
  2510. "_fromString_",
  2511. smalltalk.method({
  2512. selector: "fromString:",
  2513. category: 'instance creation',
  2514. fn: function (aString){
  2515. var self=this;
  2516. return smalltalk.withContext(function($ctx1) { var $1;
  2517. $1=_st(self)._new_(aString);
  2518. return $1;
  2519. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.Date.klass)})},
  2520. args: ["aString"],
  2521. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2522. messageSends: ["new:"],
  2523. referencedClasses: []
  2524. }),
  2525. smalltalk.Date.klass);
  2526. smalltalk.addMethod(
  2527. "_millisecondsToRun_",
  2528. smalltalk.method({
  2529. selector: "millisecondsToRun:",
  2530. category: 'instance creation',
  2531. fn: function (aBlock){
  2532. var self=this;
  2533. var t;
  2534. return smalltalk.withContext(function($ctx1) { var $1;
  2535. t=_st((smalltalk.Date || Date))._now();
  2536. _st(aBlock)._value();
  2537. $1=_st(_st((smalltalk.Date || Date))._now()).__minus(t);
  2538. return $1;
  2539. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t}, smalltalk.Date.klass)})},
  2540. args: ["aBlock"],
  2541. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2542. messageSends: ["now", "value", "-"],
  2543. referencedClasses: ["Date"]
  2544. }),
  2545. smalltalk.Date.klass);
  2546. smalltalk.addMethod(
  2547. "_new_",
  2548. smalltalk.method({
  2549. selector: "new:",
  2550. category: 'instance creation',
  2551. fn: function (anObject){
  2552. var self=this;
  2553. return smalltalk.withContext(function($ctx1) { return new Date(anObject);
  2554. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject}, smalltalk.Date.klass)})},
  2555. args: ["anObject"],
  2556. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2557. messageSends: [],
  2558. referencedClasses: []
  2559. }),
  2560. smalltalk.Date.klass);
  2561. smalltalk.addMethod(
  2562. "_now",
  2563. smalltalk.method({
  2564. selector: "now",
  2565. category: 'instance creation',
  2566. fn: function (){
  2567. var self=this;
  2568. return smalltalk.withContext(function($ctx1) { var $1;
  2569. $1=_st(self)._today();
  2570. return $1;
  2571. }, function($ctx1) {$ctx1.fill(self,"now",{}, smalltalk.Date.klass)})},
  2572. args: [],
  2573. source: "now\x0a\x09^self today",
  2574. messageSends: ["today"],
  2575. referencedClasses: []
  2576. }),
  2577. smalltalk.Date.klass);
  2578. smalltalk.addMethod(
  2579. "_today",
  2580. smalltalk.method({
  2581. selector: "today",
  2582. category: 'instance creation',
  2583. fn: function (){
  2584. var self=this;
  2585. return smalltalk.withContext(function($ctx1) { var $1;
  2586. $1=_st(self)._new();
  2587. return $1;
  2588. }, function($ctx1) {$ctx1.fill(self,"today",{}, smalltalk.Date.klass)})},
  2589. args: [],
  2590. source: "today\x0a\x09^self new",
  2591. messageSends: ["new"],
  2592. referencedClasses: []
  2593. }),
  2594. smalltalk.Date.klass);
  2595. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  2596. smalltalk.JSObjectProxy.comment="JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.\x0aJSOjbectProxy makes intensive use of `#doesNotUnderstand:`.\x0a\x0a## Examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a window alert: 'hello world'.\x0a window inspect.\x0a (window jQuery: 'body') append: 'hello world'\x0a\x0aSmalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown. \x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`."
  2597. smalltalk.addMethod(
  2598. "_addObjectVariablesTo_",
  2599. smalltalk.method({
  2600. selector: "addObjectVariablesTo:",
  2601. category: 'proxy',
  2602. fn: function (aDictionary){
  2603. var self=this;
  2604. return smalltalk.withContext(function($ctx1) {
  2605. for(var i in self['@jsObject']) {
  2606. aDictionary._at_put_(i, self['@jsObject'][i]);
  2607. }
  2608. ;
  2609. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary}, smalltalk.JSObjectProxy)})},
  2610. args: ["aDictionary"],
  2611. source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a \x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a >",
  2612. messageSends: [],
  2613. referencedClasses: []
  2614. }),
  2615. smalltalk.JSObjectProxy);
  2616. smalltalk.addMethod(
  2617. "_at_",
  2618. smalltalk.method({
  2619. selector: "at:",
  2620. category: 'accessing',
  2621. fn: function (aSymbol){
  2622. var self=this;
  2623. return smalltalk.withContext(function($ctx1) { return self['@jsObject'][aSymbol._asString()];
  2624. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aSymbol:aSymbol}, smalltalk.JSObjectProxy)})},
  2625. args: ["aSymbol"],
  2626. source: "at: aSymbol\x0a\x09<return self['@jsObject'][aSymbol._asString()]>",
  2627. messageSends: [],
  2628. referencedClasses: []
  2629. }),
  2630. smalltalk.JSObjectProxy);
  2631. smalltalk.addMethod(
  2632. "_at_ifAbsent_",
  2633. smalltalk.method({
  2634. selector: "at:ifAbsent:",
  2635. category: 'accessing',
  2636. fn: function (aSymbol,aBlock){
  2637. var self=this;
  2638. return smalltalk.withContext(function($ctx1) {
  2639. var obj = self['@jsObject'],
  2640. symbol = aSymbol._asString();
  2641. return symbol in obj ? obj[symbol] : aBlock();
  2642. ;
  2643. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aSymbol:aSymbol,aBlock:aBlock}, smalltalk.JSObjectProxy)})},
  2644. args: ["aSymbol", "aBlock"],
  2645. source: "at: aSymbol ifAbsent: aBlock\x0a\x09\x22return the aSymbol property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a \x09var obj = self['@jsObject'],\x0a \x09symbol = aSymbol._asString();\x0a\x09\x09return symbol in obj ? obj[symbol] : aBlock();\x0a\x09>",
  2646. messageSends: [],
  2647. referencedClasses: []
  2648. }),
  2649. smalltalk.JSObjectProxy);
  2650. smalltalk.addMethod(
  2651. "_at_put_",
  2652. smalltalk.method({
  2653. selector: "at:put:",
  2654. category: 'accessing',
  2655. fn: function (aSymbol,anObject){
  2656. var self=this;
  2657. return smalltalk.withContext(function($ctx1) { self['@jsObject'][aSymbol._asString()] = anObject;
  2658. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aSymbol:aSymbol,anObject:anObject}, smalltalk.JSObjectProxy)})},
  2659. args: ["aSymbol", "anObject"],
  2660. source: "at: aSymbol put: anObject\x0a\x09<self['@jsObject'][aSymbol._asString()] = anObject>",
  2661. messageSends: [],
  2662. referencedClasses: []
  2663. }),
  2664. smalltalk.JSObjectProxy);
  2665. smalltalk.addMethod(
  2666. "_canForwardMessage_",
  2667. smalltalk.method({
  2668. selector: "canForwardMessage:",
  2669. category: 'testing',
  2670. fn: function (aMessage){
  2671. var self=this;
  2672. return smalltalk.withContext(function($ctx1) {
  2673. var jsSelector = aMessage._selector()._asJavaScriptSelector();
  2674. if(jsSelector in self._jsObject()) {
  2675. return true
  2676. } else {
  2677. return false;
  2678. }
  2679. ;
  2680. return self}, function($ctx1) {$ctx1.fill(self,"canForwardMessage:",{aMessage:aMessage}, smalltalk.JSObjectProxy)})},
  2681. args: ["aMessage"],
  2682. source: "canForwardMessage: aMessage\x0a\x09<\x0a \x09var jsSelector = aMessage._selector()._asJavaScriptSelector();\x0a \x09if(jsSelector in self._jsObject()) {\x0a \x09return true\x0a } else {\x0a \x09return false;\x0a }\x0a >",
  2683. messageSends: [],
  2684. referencedClasses: []
  2685. }),
  2686. smalltalk.JSObjectProxy);
  2687. smalltalk.addMethod(
  2688. "_doesNotUnderstand_",
  2689. smalltalk.method({
  2690. selector: "doesNotUnderstand:",
  2691. category: 'proxy',
  2692. fn: function (aMessage){
  2693. var self=this;
  2694. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  2695. $2=_st(self)._canForwardMessage_(aMessage);
  2696. if(smalltalk.assert($2)){
  2697. $1=_st(self)._forwardMessage_(aMessage);
  2698. } else {
  2699. $3=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  2700. return $3;
  2701. };
  2702. return $1;
  2703. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage}, smalltalk.JSObjectProxy)})},
  2704. args: ["aMessage"],
  2705. source: "doesNotUnderstand: aMessage\x0a \x0a ^ (self canForwardMessage: aMessage) \x0a \x09ifTrue: [ self forwardMessage: aMessage ]\x0a ifFalse: [ ^ super doesNotUnderstand: aMessage ]",
  2706. messageSends: ["ifTrue:ifFalse:", "forwardMessage:", "doesNotUnderstand:", "canForwardMessage:"],
  2707. referencedClasses: []
  2708. }),
  2709. smalltalk.JSObjectProxy);
  2710. smalltalk.addMethod(
  2711. "_forwardMessage_",
  2712. smalltalk.method({
  2713. selector: "forwardMessage:",
  2714. category: 'proxy',
  2715. fn: function (aMessage){
  2716. var self=this;
  2717. return smalltalk.withContext(function($ctx1) {
  2718. return smalltalk.send(self._jsObject(), aMessage._selector()._asJavaScriptSelector(), aMessage._arguments());
  2719. ;
  2720. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:",{aMessage:aMessage}, smalltalk.JSObjectProxy)})},
  2721. args: ["aMessage"],
  2722. source: "forwardMessage: aMessage\x0a\x09<\x0a \x09return smalltalk.send(self._jsObject(), aMessage._selector()._asJavaScriptSelector(), aMessage._arguments());\x0a >",
  2723. messageSends: [],
  2724. referencedClasses: []
  2725. }),
  2726. smalltalk.JSObjectProxy);
  2727. smalltalk.addMethod(
  2728. "_inspectOn_",
  2729. smalltalk.method({
  2730. selector: "inspectOn:",
  2731. category: 'proxy',
  2732. fn: function (anInspector){
  2733. var self=this;
  2734. var variables;
  2735. return smalltalk.withContext(function($ctx1) { variables=_st((smalltalk.Dictionary || Dictionary))._new();
  2736. _st(variables)._at_put_("#self",_st(self)._jsObject());
  2737. _st(anInspector)._setLabel_(_st(self)._printString());
  2738. _st(self)._addObjectVariablesTo_(variables);
  2739. _st(anInspector)._setVariables_(variables);
  2740. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables}, smalltalk.JSObjectProxy)})},
  2741. args: ["anInspector"],
  2742. 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",
  2743. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  2744. referencedClasses: ["Dictionary"]
  2745. }),
  2746. smalltalk.JSObjectProxy);
  2747. smalltalk.addMethod(
  2748. "_jsObject",
  2749. smalltalk.method({
  2750. selector: "jsObject",
  2751. category: 'accessing',
  2752. fn: function (){
  2753. var self=this;
  2754. return smalltalk.withContext(function($ctx1) { var $1;
  2755. $1=self["@jsObject"];
  2756. return $1;
  2757. }, function($ctx1) {$ctx1.fill(self,"jsObject",{}, smalltalk.JSObjectProxy)})},
  2758. args: [],
  2759. source: "jsObject\x0a\x09^jsObject",
  2760. messageSends: [],
  2761. referencedClasses: []
  2762. }),
  2763. smalltalk.JSObjectProxy);
  2764. smalltalk.addMethod(
  2765. "_jsObject_",
  2766. smalltalk.method({
  2767. selector: "jsObject:",
  2768. category: 'accessing',
  2769. fn: function (aJSObject){
  2770. var self=this;
  2771. return smalltalk.withContext(function($ctx1) { self["@jsObject"]=aJSObject;
  2772. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject}, smalltalk.JSObjectProxy)})},
  2773. args: ["aJSObject"],
  2774. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  2775. messageSends: [],
  2776. referencedClasses: []
  2777. }),
  2778. smalltalk.JSObjectProxy);
  2779. smalltalk.addMethod(
  2780. "_keysAndValuesDo_",
  2781. smalltalk.method({
  2782. selector: "keysAndValuesDo:",
  2783. category: 'enumerating',
  2784. fn: function (aBlock){
  2785. var self=this;
  2786. return smalltalk.withContext(function($ctx1) {
  2787. var o = self['@jsObject'];
  2788. for(var i in o) {
  2789. aBlock(i, o[i]);
  2790. }
  2791. ;
  2792. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock}, smalltalk.JSObjectProxy)})},
  2793. args: ["aBlock"],
  2794. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a \x09var o = self['@jsObject'];\x0a \x09for(var i in o) {\x0a\x09\x09\x09aBlock(i, o[i]);\x0a\x09\x09}\x0a >",
  2795. messageSends: [],
  2796. referencedClasses: []
  2797. }),
  2798. smalltalk.JSObjectProxy);
  2799. smalltalk.addMethod(
  2800. "_printString",
  2801. smalltalk.method({
  2802. selector: "printString",
  2803. category: 'proxy',
  2804. fn: function (){
  2805. var self=this;
  2806. return smalltalk.withContext(function($ctx1) { var $1;
  2807. $1=_st(_st(self)._jsObject())._toString();
  2808. return $1;
  2809. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.JSObjectProxy)})},
  2810. args: [],
  2811. source: "printString\x0a\x09^self jsObject toString",
  2812. messageSends: ["toString", "jsObject"],
  2813. referencedClasses: []
  2814. }),
  2815. smalltalk.JSObjectProxy);
  2816. smalltalk.addMethod(
  2817. "_value",
  2818. smalltalk.method({
  2819. selector: "value",
  2820. category: 'accessing',
  2821. fn: function (){
  2822. var self=this;
  2823. return smalltalk.withContext(function($ctx1) { var $1;
  2824. $1=_st(self)._at_ifAbsent_("value",(function(){
  2825. return smalltalk.withContext(function($ctx2) { return smalltalk.Object.fn.prototype._value.apply(_st(self), []);
  2826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2827. return $1;
  2828. }, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.JSObjectProxy)})},
  2829. args: [],
  2830. source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a otherwise return the result of Object>>value.\x22\x0a\x09^ self at: 'value' ifAbsent: [super value]",
  2831. messageSends: ["at:ifAbsent:", "value"],
  2832. referencedClasses: []
  2833. }),
  2834. smalltalk.JSObjectProxy);
  2835. smalltalk.addMethod(
  2836. "_on_",
  2837. smalltalk.method({
  2838. selector: "on:",
  2839. category: 'instance creation',
  2840. fn: function (aJSObject){
  2841. var self=this;
  2842. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  2843. $2=_st(self)._new();
  2844. _st($2)._jsObject_(aJSObject);
  2845. $3=_st($2)._yourself();
  2846. $1=$3;
  2847. return $1;
  2848. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject}, smalltalk.JSObjectProxy.klass)})},
  2849. args: ["aJSObject"],
  2850. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  2851. messageSends: ["jsObject:", "new", "yourself"],
  2852. referencedClasses: []
  2853. }),
  2854. smalltalk.JSObjectProxy.klass);
  2855. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  2856. smalltalk.Number.comment="Number holds the most general methods for dealing with numbers. \x0aNumber is directly mapped to JavaScript Number.\x0a\x0aMost arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript. \x0a\x0a##Enumerating\x0aA Number can be used to evaluate a Block a fixed number of times:\x0a\x0a\x095 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].\x0a\x09\x0a\x091 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].\x0a\x09\x0a\x091 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr]."
  2857. smalltalk.addMethod(
  2858. "__and",
  2859. smalltalk.method({
  2860. selector: "&",
  2861. category: 'converting',
  2862. fn: function (aNumber){
  2863. var self=this;
  2864. return smalltalk.withContext(function($ctx1) { return self & aNumber;
  2865. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber}, smalltalk.Number)})},
  2866. args: ["aNumber"],
  2867. source: "& aNumber\x0a\x09<return self & aNumber>",
  2868. messageSends: [],
  2869. referencedClasses: []
  2870. }),
  2871. smalltalk.Number);
  2872. smalltalk.addMethod(
  2873. "__star",
  2874. smalltalk.method({
  2875. selector: "*",
  2876. category: 'arithmetic',
  2877. fn: function (aNumber){
  2878. var self=this;
  2879. return smalltalk.withContext(function($ctx1) { return self * aNumber;
  2880. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber}, smalltalk.Number)})},
  2881. args: ["aNumber"],
  2882. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  2883. messageSends: [],
  2884. referencedClasses: []
  2885. }),
  2886. smalltalk.Number);
  2887. smalltalk.addMethod(
  2888. "__plus",
  2889. smalltalk.method({
  2890. selector: "+",
  2891. category: 'arithmetic',
  2892. fn: function (aNumber){
  2893. var self=this;
  2894. return smalltalk.withContext(function($ctx1) { return self + aNumber;
  2895. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber}, smalltalk.Number)})},
  2896. args: ["aNumber"],
  2897. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  2898. messageSends: [],
  2899. referencedClasses: []
  2900. }),
  2901. smalltalk.Number);
  2902. smalltalk.addMethod(
  2903. "__minus",
  2904. smalltalk.method({
  2905. selector: "-",
  2906. category: 'arithmetic',
  2907. fn: function (aNumber){
  2908. var self=this;
  2909. return smalltalk.withContext(function($ctx1) { return self - aNumber;
  2910. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber}, smalltalk.Number)})},
  2911. args: ["aNumber"],
  2912. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  2913. messageSends: [],
  2914. referencedClasses: []
  2915. }),
  2916. smalltalk.Number);
  2917. smalltalk.addMethod(
  2918. "__slash",
  2919. smalltalk.method({
  2920. selector: "/",
  2921. category: 'arithmetic',
  2922. fn: function (aNumber){
  2923. var self=this;
  2924. return smalltalk.withContext(function($ctx1) { return self / aNumber;
  2925. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber}, smalltalk.Number)})},
  2926. args: ["aNumber"],
  2927. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  2928. messageSends: [],
  2929. referencedClasses: []
  2930. }),
  2931. smalltalk.Number);
  2932. smalltalk.addMethod(
  2933. "__lt",
  2934. smalltalk.method({
  2935. selector: "<",
  2936. category: 'comparing',
  2937. fn: function (aNumber){
  2938. var self=this;
  2939. return smalltalk.withContext(function($ctx1) { return self < aNumber;
  2940. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber}, smalltalk.Number)})},
  2941. args: ["aNumber"],
  2942. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  2943. messageSends: [],
  2944. referencedClasses: []
  2945. }),
  2946. smalltalk.Number);
  2947. smalltalk.addMethod(
  2948. "__lt_eq",
  2949. smalltalk.method({
  2950. selector: "<=",
  2951. category: 'comparing',
  2952. fn: function (aNumber){
  2953. var self=this;
  2954. return smalltalk.withContext(function($ctx1) { return self <= aNumber;
  2955. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber}, smalltalk.Number)})},
  2956. args: ["aNumber"],
  2957. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  2958. messageSends: [],
  2959. referencedClasses: []
  2960. }),
  2961. smalltalk.Number);
  2962. smalltalk.addMethod(
  2963. "__eq",
  2964. smalltalk.method({
  2965. selector: "=",
  2966. category: 'comparing',
  2967. fn: function (aNumber){
  2968. var self=this;
  2969. return smalltalk.withContext(function($ctx1) {
  2970. if(! aNumber._isNumber || ! aNumber._isNumber()) {
  2971. return false;
  2972. }
  2973. return Number(self) == aNumber
  2974. ;
  2975. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber}, smalltalk.Number)})},
  2976. args: ["aNumber"],
  2977. source: "= aNumber\x0a\x09<\x0a \x09if(! aNumber._isNumber || ! aNumber._isNumber()) {\x0a \x09return false;\x0a }\x0a \x09return Number(self) == aNumber\x0a >",
  2978. messageSends: [],
  2979. referencedClasses: []
  2980. }),
  2981. smalltalk.Number);
  2982. smalltalk.addMethod(
  2983. "__gt",
  2984. smalltalk.method({
  2985. selector: ">",
  2986. category: 'comparing',
  2987. fn: function (aNumber){
  2988. var self=this;
  2989. return smalltalk.withContext(function($ctx1) { return self > aNumber;
  2990. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber}, smalltalk.Number)})},
  2991. args: ["aNumber"],
  2992. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  2993. messageSends: [],
  2994. referencedClasses: []
  2995. }),
  2996. smalltalk.Number);
  2997. smalltalk.addMethod(
  2998. "__gt_eq",
  2999. smalltalk.method({
  3000. selector: ">=",
  3001. category: 'comparing',
  3002. fn: function (aNumber){
  3003. var self=this;
  3004. return smalltalk.withContext(function($ctx1) { return self >= aNumber;
  3005. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber}, smalltalk.Number)})},
  3006. args: ["aNumber"],
  3007. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3008. messageSends: [],
  3009. referencedClasses: []
  3010. }),
  3011. smalltalk.Number);
  3012. smalltalk.addMethod(
  3013. "__at",
  3014. smalltalk.method({
  3015. selector: "@",
  3016. category: 'converting',
  3017. fn: function (aNumber){
  3018. var self=this;
  3019. return smalltalk.withContext(function($ctx1) { var $1;
  3020. $1=_st((smalltalk.Point || Point))._x_y_(self,aNumber);
  3021. return $1;
  3022. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber}, smalltalk.Number)})},
  3023. args: ["aNumber"],
  3024. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  3025. messageSends: ["x:y:"],
  3026. referencedClasses: ["Point"]
  3027. }),
  3028. smalltalk.Number);
  3029. smalltalk.addMethod(
  3030. "__backslash",
  3031. smalltalk.method({
  3032. selector: "\x5c",
  3033. category: 'arithmetic',
  3034. fn: function (aNumber){
  3035. var self=this;
  3036. return smalltalk.withContext(function($ctx1) { return self % aNumber;
  3037. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber}, smalltalk.Number)})},
  3038. args: ["aNumber"],
  3039. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3040. messageSends: [],
  3041. referencedClasses: []
  3042. }),
  3043. smalltalk.Number);
  3044. smalltalk.addMethod(
  3045. "__backslash_backslash",
  3046. smalltalk.method({
  3047. selector: "\x5c\x5c",
  3048. category: 'arithmetic',
  3049. fn: function (aNumber) {
  3050. var self = this;
  3051. return self % aNumber;
  3052. return self;
  3053. },
  3054. args: ["aNumber"],
  3055. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3056. messageSends: [],
  3057. referencedClasses: []
  3058. }),
  3059. smalltalk.Number);
  3060. smalltalk.addMethod(
  3061. "_abs",
  3062. smalltalk.method({
  3063. selector: "abs",
  3064. category: 'arithmetic',
  3065. fn: function (){
  3066. var self=this;
  3067. return smalltalk.withContext(function($ctx1) { return Math.abs(self);;
  3068. return self}, function($ctx1) {$ctx1.fill(self,"abs",{}, smalltalk.Number)})},
  3069. args: [],
  3070. source: "abs\x0a\x09<return Math.abs(self);>",
  3071. messageSends: [],
  3072. referencedClasses: []
  3073. }),
  3074. smalltalk.Number);
  3075. smalltalk.addMethod(
  3076. "_asJSON",
  3077. smalltalk.method({
  3078. selector: "asJSON",
  3079. category: 'converting',
  3080. fn: function (){
  3081. var self=this;
  3082. return smalltalk.withContext(function($ctx1) { var $1;
  3083. $1=self;
  3084. return $1;
  3085. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Number)})},
  3086. args: [],
  3087. source: "asJSON\x0a\x09^self",
  3088. messageSends: [],
  3089. referencedClasses: []
  3090. }),
  3091. smalltalk.Number);
  3092. smalltalk.addMethod(
  3093. "_asJavascript",
  3094. smalltalk.method({
  3095. selector: "asJavascript",
  3096. category: 'converting',
  3097. fn: function (){
  3098. var self=this;
  3099. return smalltalk.withContext(function($ctx1) { var $1;
  3100. $1=_st(_st("(").__comma(_st(self)._printString())).__comma(")");
  3101. return $1;
  3102. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Number)})},
  3103. args: [],
  3104. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  3105. messageSends: [",", "printString"],
  3106. referencedClasses: []
  3107. }),
  3108. smalltalk.Number);
  3109. smalltalk.addMethod(
  3110. "_asPoint",
  3111. smalltalk.method({
  3112. selector: "asPoint",
  3113. category: 'converting',
  3114. fn: function (){
  3115. var self=this;
  3116. return smalltalk.withContext(function($ctx1) { var $1;
  3117. $1=_st((smalltalk.Point || Point))._x_y_(self,self);
  3118. return $1;
  3119. }, function($ctx1) {$ctx1.fill(self,"asPoint",{}, smalltalk.Number)})},
  3120. args: [],
  3121. source: "asPoint\x0a\x09^Point x: self y: self",
  3122. messageSends: ["x:y:"],
  3123. referencedClasses: ["Point"]
  3124. }),
  3125. smalltalk.Number);
  3126. smalltalk.addMethod(
  3127. "_asString",
  3128. smalltalk.method({
  3129. selector: "asString",
  3130. category: 'converting',
  3131. fn: function (){
  3132. var self=this;
  3133. return smalltalk.withContext(function($ctx1) { var $1;
  3134. $1=_st(self)._printString();
  3135. return $1;
  3136. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Number)})},
  3137. args: [],
  3138. source: "asString\x0a\x09^self printString",
  3139. messageSends: ["printString"],
  3140. referencedClasses: []
  3141. }),
  3142. smalltalk.Number);
  3143. smalltalk.addMethod(
  3144. "_atRandom",
  3145. smalltalk.method({
  3146. selector: "atRandom",
  3147. category: 'converting',
  3148. fn: function (){
  3149. var self=this;
  3150. return smalltalk.withContext(function($ctx1) { var $1;
  3151. $1=_st(_st(_st(_st(_st((smalltalk.Random || Random))._new())._next()).__star(self))._truncated()).__plus((1));
  3152. return $1;
  3153. }, function($ctx1) {$ctx1.fill(self,"atRandom",{}, smalltalk.Number)})},
  3154. args: [],
  3155. source: "atRandom\x0a ^(Random new next * self) truncated + 1",
  3156. messageSends: ["+", "truncated", "*", "next", "new"],
  3157. referencedClasses: ["Random"]
  3158. }),
  3159. smalltalk.Number);
  3160. smalltalk.addMethod(
  3161. "_copy",
  3162. smalltalk.method({
  3163. selector: "copy",
  3164. category: 'copying',
  3165. fn: function (){
  3166. var self=this;
  3167. return smalltalk.withContext(function($ctx1) { var $1;
  3168. $1=self;
  3169. return $1;
  3170. }, function($ctx1) {$ctx1.fill(self,"copy",{}, smalltalk.Number)})},
  3171. args: [],
  3172. source: "copy\x0a\x09^self",
  3173. messageSends: [],
  3174. referencedClasses: []
  3175. }),
  3176. smalltalk.Number);
  3177. smalltalk.addMethod(
  3178. "_deepCopy",
  3179. smalltalk.method({
  3180. selector: "deepCopy",
  3181. category: 'copying',
  3182. fn: function (){
  3183. var self=this;
  3184. return smalltalk.withContext(function($ctx1) { var $1;
  3185. $1=_st(self)._copy();
  3186. return $1;
  3187. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Number)})},
  3188. args: [],
  3189. source: "deepCopy\x0a\x09^self copy",
  3190. messageSends: ["copy"],
  3191. referencedClasses: []
  3192. }),
  3193. smalltalk.Number);
  3194. smalltalk.addMethod(
  3195. "_even",
  3196. smalltalk.method({
  3197. selector: "even",
  3198. category: 'testing',
  3199. fn: function (){
  3200. var self=this;
  3201. return smalltalk.withContext(function($ctx1) { var $1;
  3202. $1=_st((0)).__eq(_st(self).__backslash_backslash((2)));
  3203. return $1;
  3204. }, function($ctx1) {$ctx1.fill(self,"even",{}, smalltalk.Number)})},
  3205. args: [],
  3206. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3207. messageSends: ["=", "\x5c\x5c"],
  3208. referencedClasses: []
  3209. }),
  3210. smalltalk.Number);
  3211. smalltalk.addMethod(
  3212. "_identityHash",
  3213. smalltalk.method({
  3214. selector: "identityHash",
  3215. category: 'accessing',
  3216. fn: function (){
  3217. var self=this;
  3218. return smalltalk.withContext(function($ctx1) { var $1;
  3219. $1=_st(_st(self)._asString()).__comma("n");
  3220. return $1;
  3221. }, function($ctx1) {$ctx1.fill(self,"identityHash",{}, smalltalk.Number)})},
  3222. args: [],
  3223. source: "identityHash\x0a\x09^self asString, 'n'",
  3224. messageSends: [",", "asString"],
  3225. referencedClasses: []
  3226. }),
  3227. smalltalk.Number);
  3228. smalltalk.addMethod(
  3229. "_isNumber",
  3230. smalltalk.method({
  3231. selector: "isNumber",
  3232. category: 'testing',
  3233. fn: function (){
  3234. var self=this;
  3235. return smalltalk.withContext(function($ctx1) { return true;
  3236. }, function($ctx1) {$ctx1.fill(self,"isNumber",{}, smalltalk.Number)})},
  3237. args: [],
  3238. source: "isNumber\x0a\x09^true",
  3239. messageSends: [],
  3240. referencedClasses: []
  3241. }),
  3242. smalltalk.Number);
  3243. smalltalk.addMethod(
  3244. "_isZero",
  3245. smalltalk.method({
  3246. selector: "isZero",
  3247. category: 'testing',
  3248. fn: function (){
  3249. var self=this;
  3250. return smalltalk.withContext(function($ctx1) { var $1;
  3251. $1=_st(self).__eq((0));
  3252. return $1;
  3253. }, function($ctx1) {$ctx1.fill(self,"isZero",{}, smalltalk.Number)})},
  3254. args: [],
  3255. source: "isZero\x0a\x09^self = 0",
  3256. messageSends: ["="],
  3257. referencedClasses: []
  3258. }),
  3259. smalltalk.Number);
  3260. smalltalk.addMethod(
  3261. "_max_",
  3262. smalltalk.method({
  3263. selector: "max:",
  3264. category: 'arithmetic',
  3265. fn: function (aNumber){
  3266. var self=this;
  3267. return smalltalk.withContext(function($ctx1) { return Math.max(self, aNumber);;
  3268. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber}, smalltalk.Number)})},
  3269. args: ["aNumber"],
  3270. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3271. messageSends: [],
  3272. referencedClasses: []
  3273. }),
  3274. smalltalk.Number);
  3275. smalltalk.addMethod(
  3276. "_min_",
  3277. smalltalk.method({
  3278. selector: "min:",
  3279. category: 'arithmetic',
  3280. fn: function (aNumber){
  3281. var self=this;
  3282. return smalltalk.withContext(function($ctx1) { return Math.min(self, aNumber);;
  3283. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber}, smalltalk.Number)})},
  3284. args: ["aNumber"],
  3285. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3286. messageSends: [],
  3287. referencedClasses: []
  3288. }),
  3289. smalltalk.Number);
  3290. smalltalk.addMethod(
  3291. "_negated",
  3292. smalltalk.method({
  3293. selector: "negated",
  3294. category: 'arithmetic',
  3295. fn: function (){
  3296. var self=this;
  3297. return smalltalk.withContext(function($ctx1) { var $1;
  3298. $1=_st((0)).__minus(self);
  3299. return $1;
  3300. }, function($ctx1) {$ctx1.fill(self,"negated",{}, smalltalk.Number)})},
  3301. args: [],
  3302. source: "negated\x0a\x09^0 - self",
  3303. messageSends: ["-"],
  3304. referencedClasses: []
  3305. }),
  3306. smalltalk.Number);
  3307. smalltalk.addMethod(
  3308. "_negative",
  3309. smalltalk.method({
  3310. selector: "negative",
  3311. category: 'testing',
  3312. fn: function (){
  3313. var self=this;
  3314. return smalltalk.withContext(function($ctx1) { var $1;
  3315. $1=_st(self).__lt((0));
  3316. return $1;
  3317. }, function($ctx1) {$ctx1.fill(self,"negative",{}, smalltalk.Number)})},
  3318. args: [],
  3319. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3320. messageSends: ["<"],
  3321. referencedClasses: []
  3322. }),
  3323. smalltalk.Number);
  3324. smalltalk.addMethod(
  3325. "_odd",
  3326. smalltalk.method({
  3327. selector: "odd",
  3328. category: 'testing',
  3329. fn: function (){
  3330. var self=this;
  3331. return smalltalk.withContext(function($ctx1) { var $1;
  3332. $1=_st(_st(self)._even())._not();
  3333. return $1;
  3334. }, function($ctx1) {$ctx1.fill(self,"odd",{}, smalltalk.Number)})},
  3335. args: [],
  3336. source: "odd\x0a\x09^ self even not",
  3337. messageSends: ["not", "even"],
  3338. referencedClasses: []
  3339. }),
  3340. smalltalk.Number);
  3341. smalltalk.addMethod(
  3342. "_positive",
  3343. smalltalk.method({
  3344. selector: "positive",
  3345. category: 'testing',
  3346. fn: function (){
  3347. var self=this;
  3348. return smalltalk.withContext(function($ctx1) { var $1;
  3349. $1=_st(self).__gt_eq((0));
  3350. return $1;
  3351. }, function($ctx1) {$ctx1.fill(self,"positive",{}, smalltalk.Number)})},
  3352. args: [],
  3353. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3354. messageSends: [">="],
  3355. referencedClasses: []
  3356. }),
  3357. smalltalk.Number);
  3358. smalltalk.addMethod(
  3359. "_printShowingDecimalPlaces_",
  3360. smalltalk.method({
  3361. selector: "printShowingDecimalPlaces:",
  3362. category: 'printing',
  3363. fn: function (placesDesired){
  3364. var self=this;
  3365. return smalltalk.withContext(function($ctx1) { return self.toFixed(placesDesired);
  3366. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired}, smalltalk.Number)})},
  3367. args: ["placesDesired"],
  3368. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  3369. messageSends: [],
  3370. referencedClasses: []
  3371. }),
  3372. smalltalk.Number);
  3373. smalltalk.addMethod(
  3374. "_printString",
  3375. smalltalk.method({
  3376. selector: "printString",
  3377. category: 'printing',
  3378. fn: function (){
  3379. var self=this;
  3380. return smalltalk.withContext(function($ctx1) { return String(self);
  3381. return self}, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Number)})},
  3382. args: [],
  3383. source: "printString\x0a\x09<return String(self)>",
  3384. messageSends: [],
  3385. referencedClasses: []
  3386. }),
  3387. smalltalk.Number);
  3388. smalltalk.addMethod(
  3389. "_rounded",
  3390. smalltalk.method({
  3391. selector: "rounded",
  3392. category: 'converting',
  3393. fn: function (){
  3394. var self=this;
  3395. return smalltalk.withContext(function($ctx1) { return Math.round(self);;
  3396. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{}, smalltalk.Number)})},
  3397. args: [],
  3398. source: "rounded\x0a\x09<return Math.round(self);>",
  3399. messageSends: [],
  3400. referencedClasses: []
  3401. }),
  3402. smalltalk.Number);
  3403. smalltalk.addMethod(
  3404. "_sqrt",
  3405. smalltalk.method({
  3406. selector: "sqrt",
  3407. category: 'arithmetic',
  3408. fn: function (){
  3409. var self=this;
  3410. return smalltalk.withContext(function($ctx1) { return Math.sqrt(self);
  3411. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{}, smalltalk.Number)})},
  3412. args: [],
  3413. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  3414. messageSends: [],
  3415. referencedClasses: []
  3416. }),
  3417. smalltalk.Number);
  3418. smalltalk.addMethod(
  3419. "_squared",
  3420. smalltalk.method({
  3421. selector: "squared",
  3422. category: 'arithmetic',
  3423. fn: function (){
  3424. var self=this;
  3425. return smalltalk.withContext(function($ctx1) { var $1;
  3426. $1=_st(self).__star(self);
  3427. return $1;
  3428. }, function($ctx1) {$ctx1.fill(self,"squared",{}, smalltalk.Number)})},
  3429. args: [],
  3430. source: "squared\x0a\x09^self * self",
  3431. messageSends: ["*"],
  3432. referencedClasses: []
  3433. }),
  3434. smalltalk.Number);
  3435. smalltalk.addMethod(
  3436. "_timesRepeat_",
  3437. smalltalk.method({
  3438. selector: "timesRepeat:",
  3439. category: 'enumerating',
  3440. fn: function (aBlock){
  3441. var self=this;
  3442. var count;
  3443. return smalltalk.withContext(function($ctx1) { count=(1);
  3444. _st((function(){
  3445. return smalltalk.withContext(function($ctx2) { return _st(count).__gt(self);
  3446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  3447. return smalltalk.withContext(function($ctx2) { _st(aBlock)._value();
  3448. count=_st(count).__plus((1));
  3449. return count;
  3450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3451. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count}, smalltalk.Number)})},
  3452. args: ["aBlock"],
  3453. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09 aBlock value.\x0a\x09 count := count + 1]",
  3454. messageSends: ["whileFalse:", "value", "+", ">"],
  3455. referencedClasses: []
  3456. }),
  3457. smalltalk.Number);
  3458. smalltalk.addMethod(
  3459. "_to_",
  3460. smalltalk.method({
  3461. selector: "to:",
  3462. category: 'converting',
  3463. fn: function (aNumber){
  3464. var self=this;
  3465. var array,first,last,count;
  3466. return smalltalk.withContext(function($ctx1) { var $1;
  3467. first=_st(self)._truncated();
  3468. last=_st(_st(aNumber)._truncated()).__plus((1));
  3469. count=(1);
  3470. array=_st((smalltalk.Array || Array))._new();
  3471. _st(_st(last).__minus(first))._timesRepeat_((function(){
  3472. return smalltalk.withContext(function($ctx2) { _st(array)._at_put_(count,first);
  3473. count=_st(count).__plus((1));
  3474. count;
  3475. first=_st(first).__plus((1));
  3476. return first;
  3477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3478. $1=array;
  3479. return $1;
  3480. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count}, smalltalk.Number)})},
  3481. args: ["aNumber"],
  3482. 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 array at: count put: first.\x0a\x09 count := count + 1.\x0a\x09 first := first + 1].\x0a\x09^array",
  3483. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  3484. referencedClasses: ["Array"]
  3485. }),
  3486. smalltalk.Number);
  3487. smalltalk.addMethod(
  3488. "_to_by_",
  3489. smalltalk.method({
  3490. selector: "to:by:",
  3491. category: 'converting',
  3492. fn: function (stop,step){
  3493. var self=this;
  3494. var array,value,pos;
  3495. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  3496. value=self;
  3497. array=_st((smalltalk.Array || Array))._new();
  3498. pos=(1);
  3499. $1=_st(step).__eq((0));
  3500. if(smalltalk.assert($1)){
  3501. _st(self)._error_("step must be non-zero");
  3502. };
  3503. $2=_st(step).__lt((0));
  3504. if(smalltalk.assert($2)){
  3505. _st((function(){
  3506. return smalltalk.withContext(function($ctx2) { return _st(value).__gt_eq(stop);
  3507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3508. return smalltalk.withContext(function($ctx2) { _st(array)._at_put_(pos,value);
  3509. pos=_st(pos).__plus((1));
  3510. pos;
  3511. value=_st(value).__plus(step);
  3512. return value;
  3513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3514. } else {
  3515. _st((function(){
  3516. return smalltalk.withContext(function($ctx2) { return _st(value).__lt_eq(stop);
  3517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3518. return smalltalk.withContext(function($ctx2) { _st(array)._at_put_(pos,value);
  3519. pos=_st(pos).__plus((1));
  3520. pos;
  3521. value=_st(value).__plus(step);
  3522. return value;
  3523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3524. };
  3525. $3=array;
  3526. return $3;
  3527. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos}, smalltalk.Number)})},
  3528. args: ["stop", "step"],
  3529. 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\x09array at: pos put: value.\x0a\x09 \x09\x09\x09pos := pos + 1.\x0a\x09 \x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09 \x09\x09\x09array at: pos put: value.\x0a\x09 \x09\x09\x09pos := pos + 1.\x0a\x09 \x09\x09\x09value := value + step]].\x0a\x09^array",
  3530. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  3531. referencedClasses: ["Array"]
  3532. }),
  3533. smalltalk.Number);
  3534. smalltalk.addMethod(
  3535. "_to_by_do_",
  3536. smalltalk.method({
  3537. selector: "to:by:do:",
  3538. category: 'enumerating',
  3539. fn: function (stop,step,aBlock){
  3540. var self=this;
  3541. var value;
  3542. return smalltalk.withContext(function($ctx1) { var $1,$2;
  3543. value=self;
  3544. $1=_st(step).__eq((0));
  3545. if(smalltalk.assert($1)){
  3546. _st(self)._error_("step must be non-zero");
  3547. };
  3548. $2=_st(step).__lt((0));
  3549. if(smalltalk.assert($2)){
  3550. _st((function(){
  3551. return smalltalk.withContext(function($ctx2) { return _st(value).__gt_eq(stop);
  3552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3553. return smalltalk.withContext(function($ctx2) { _st(aBlock)._value_(value);
  3554. value=_st(value).__plus(step);
  3555. return value;
  3556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3557. } else {
  3558. _st((function(){
  3559. return smalltalk.withContext(function($ctx2) { return _st(value).__lt_eq(stop);
  3560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3561. return smalltalk.withContext(function($ctx2) { _st(aBlock)._value_(value);
  3562. value=_st(value).__plus(step);
  3563. return value;
  3564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3565. };
  3566. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value}, smalltalk.Number)})},
  3567. args: ["stop", "step", "aBlock"],
  3568. 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\x09aBlock value: value.\x0a\x09 \x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09 \x09\x09\x09aBlock value: value.\x0a\x09 \x09\x09\x09value := value + step]]",
  3569. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  3570. referencedClasses: []
  3571. }),
  3572. smalltalk.Number);
  3573. smalltalk.addMethod(
  3574. "_to_do_",
  3575. smalltalk.method({
  3576. selector: "to:do:",
  3577. category: 'enumerating',
  3578. fn: function (stop,aBlock){
  3579. var self=this;
  3580. var nextValue;
  3581. return smalltalk.withContext(function($ctx1) { nextValue=self;
  3582. _st((function(){
  3583. return smalltalk.withContext(function($ctx2) { return _st(nextValue).__lt_eq(stop);
  3584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3585. return smalltalk.withContext(function($ctx2) { _st(aBlock)._value_(nextValue);
  3586. nextValue=_st(nextValue).__plus((1));
  3587. return nextValue;
  3588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3589. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue}, smalltalk.Number)})},
  3590. args: ["stop", "aBlock"],
  3591. 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]",
  3592. messageSends: ["whileTrue:", "value:", "+", "<="],
  3593. referencedClasses: []
  3594. }),
  3595. smalltalk.Number);
  3596. smalltalk.addMethod(
  3597. "_truncated",
  3598. smalltalk.method({
  3599. selector: "truncated",
  3600. category: 'converting',
  3601. fn: function (){
  3602. var self=this;
  3603. return smalltalk.withContext(function($ctx1) {
  3604. if(self >= 0) {
  3605. return Math.floor(self);
  3606. } else {
  3607. return Math.floor(self * (-1)) * (-1);
  3608. };
  3609. ;
  3610. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{}, smalltalk.Number)})},
  3611. args: [],
  3612. source: "truncated\x0a\x09<\x0a \x09if(self >>= 0) {\x0a \x09return Math.floor(self);\x0a } else {\x0a \x09return Math.floor(self * (-1)) * (-1);\x0a };\x0a >",
  3613. messageSends: [],
  3614. referencedClasses: []
  3615. }),
  3616. smalltalk.Number);
  3617. smalltalk.addMethod(
  3618. "__or",
  3619. smalltalk.method({
  3620. selector: "|",
  3621. category: 'converting',
  3622. fn: function (aNumber){
  3623. var self=this;
  3624. return smalltalk.withContext(function($ctx1) { return self | aNumber;
  3625. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber}, smalltalk.Number)})},
  3626. args: ["aNumber"],
  3627. source: "| aNumber\x0a\x09<return self | aNumber>",
  3628. messageSends: [],
  3629. referencedClasses: []
  3630. }),
  3631. smalltalk.Number);
  3632. smalltalk.addMethod(
  3633. "_pi",
  3634. smalltalk.method({
  3635. selector: "pi",
  3636. category: 'instance creation',
  3637. fn: function (){
  3638. var self=this;
  3639. return smalltalk.withContext(function($ctx1) { return Math.PI;
  3640. return self}, function($ctx1) {$ctx1.fill(self,"pi",{}, smalltalk.Number.klass)})},
  3641. args: [],
  3642. source: "pi\x0a\x09<return Math.PI>",
  3643. messageSends: [],
  3644. referencedClasses: []
  3645. }),
  3646. smalltalk.Number.klass);
  3647. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  3648. smalltalk.addMethod(
  3649. "_addElement_",
  3650. smalltalk.method({
  3651. selector: "addElement:",
  3652. category: 'accessing',
  3653. fn: function (anObject){
  3654. var self=this;
  3655. return smalltalk.withContext(function($ctx1) { self.elements.addElement(anObject);
  3656. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject}, smalltalk.Organizer)})},
  3657. args: ["anObject"],
  3658. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  3659. messageSends: [],
  3660. referencedClasses: []
  3661. }),
  3662. smalltalk.Organizer);
  3663. smalltalk.addMethod(
  3664. "_elements",
  3665. smalltalk.method({
  3666. selector: "elements",
  3667. category: 'accessing',
  3668. fn: function (){
  3669. var self=this;
  3670. return smalltalk.withContext(function($ctx1) { var $1;
  3671. $1=_st(_st(self)._basicAt_("elements"))._copy();
  3672. return $1;
  3673. }, function($ctx1) {$ctx1.fill(self,"elements",{}, smalltalk.Organizer)})},
  3674. args: [],
  3675. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  3676. messageSends: ["copy", "basicAt:"],
  3677. referencedClasses: []
  3678. }),
  3679. smalltalk.Organizer);
  3680. smalltalk.addMethod(
  3681. "_removeElement_",
  3682. smalltalk.method({
  3683. selector: "removeElement:",
  3684. category: 'accessing',
  3685. fn: function (anObject){
  3686. var self=this;
  3687. return smalltalk.withContext(function($ctx1) { self.elements.removeElement(anObject);
  3688. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject}, smalltalk.Organizer)})},
  3689. args: ["anObject"],
  3690. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  3691. messageSends: [],
  3692. referencedClasses: []
  3693. }),
  3694. smalltalk.Organizer);
  3695. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  3696. smalltalk.Package.comment="A Package is similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aA Package has a name, an Array of \x22requires\x22, a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name:\x0a\x0a\x09Smalltalk current packageAt: 'Kernel'\x0a\x0a...but you can also use:\x0a\x0a\x09Package named: 'Kernel'\x0a\x0aA Package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a Package supports \x22class extensions\x22 so a Package\x0acan define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows. This can easily be seen in for example class\x0aString where the method category \x22*IDE\x22 defines #inspectOn: which thus is a method belonging to the IDE package.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package fetch: 'Additional-Examples'"
  3697. smalltalk.addMethod(
  3698. "_classes",
  3699. smalltalk.method({
  3700. selector: "classes",
  3701. category: 'classes',
  3702. fn: function (){
  3703. var self=this;
  3704. return smalltalk.withContext(function($ctx1) { var $1;
  3705. $1=_st(_st(self)._organization())._elements();
  3706. return $1;
  3707. }, function($ctx1) {$ctx1.fill(self,"classes",{}, smalltalk.Package)})},
  3708. args: [],
  3709. source: "classes\x0a\x09^ self organization elements",
  3710. messageSends: ["elements", "organization"],
  3711. referencedClasses: []
  3712. }),
  3713. smalltalk.Package);
  3714. smalltalk.addMethod(
  3715. "_commitPathJs",
  3716. smalltalk.method({
  3717. selector: "commitPathJs",
  3718. category: 'accessing',
  3719. fn: function (){
  3720. var self=this;
  3721. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3722. $2=self["@commitPathJs"];
  3723. if(($receiver = $2) == nil || $receiver == undefined){
  3724. $1=_st(_st(self)._class())._defaultCommitPathJs();
  3725. } else {
  3726. $1=$2;
  3727. };
  3728. return $1;
  3729. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{}, smalltalk.Package)})},
  3730. args: [],
  3731. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  3732. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  3733. referencedClasses: []
  3734. }),
  3735. smalltalk.Package);
  3736. smalltalk.addMethod(
  3737. "_commitPathJs_",
  3738. smalltalk.method({
  3739. selector: "commitPathJs:",
  3740. category: 'accessing',
  3741. fn: function (aString){
  3742. var self=this;
  3743. return smalltalk.withContext(function($ctx1) { self["@commitPathJs"]=aString;
  3744. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString}, smalltalk.Package)})},
  3745. args: ["aString"],
  3746. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  3747. messageSends: [],
  3748. referencedClasses: []
  3749. }),
  3750. smalltalk.Package);
  3751. smalltalk.addMethod(
  3752. "_commitPathSt",
  3753. smalltalk.method({
  3754. selector: "commitPathSt",
  3755. category: 'accessing',
  3756. fn: function (){
  3757. var self=this;
  3758. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3759. $2=self["@commitPathSt"];
  3760. if(($receiver = $2) == nil || $receiver == undefined){
  3761. $1=_st(_st(self)._class())._defaultCommitPathSt();
  3762. } else {
  3763. $1=$2;
  3764. };
  3765. return $1;
  3766. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{}, smalltalk.Package)})},
  3767. args: [],
  3768. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  3769. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  3770. referencedClasses: []
  3771. }),
  3772. smalltalk.Package);
  3773. smalltalk.addMethod(
  3774. "_commitPathSt_",
  3775. smalltalk.method({
  3776. selector: "commitPathSt:",
  3777. category: 'accessing',
  3778. fn: function (aString){
  3779. var self=this;
  3780. return smalltalk.withContext(function($ctx1) { self["@commitPathSt"]=aString;
  3781. return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString}, smalltalk.Package)})},
  3782. args: ["aString"],
  3783. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  3784. messageSends: [],
  3785. referencedClasses: []
  3786. }),
  3787. smalltalk.Package);
  3788. smalltalk.addMethod(
  3789. "_dependencies",
  3790. smalltalk.method({
  3791. selector: "dependencies",
  3792. category: 'accessing',
  3793. fn: function (){
  3794. var self=this;
  3795. return smalltalk.withContext(function($ctx1) { var $1;
  3796. $1=_st(self)._propertyAt_ifAbsent_("dependencies",(function(){
  3797. return smalltalk.withContext(function($ctx2) { return [];
  3798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3799. return $1;
  3800. }, function($ctx1) {$ctx1.fill(self,"dependencies",{}, smalltalk.Package)})},
  3801. args: [],
  3802. source: "dependencies\x0a\x09^self propertyAt: 'dependencies' ifAbsent: [#()]",
  3803. messageSends: ["propertyAt:ifAbsent:"],
  3804. referencedClasses: []
  3805. }),
  3806. smalltalk.Package);
  3807. smalltalk.addMethod(
  3808. "_dependencies_",
  3809. smalltalk.method({
  3810. selector: "dependencies:",
  3811. category: 'accessing',
  3812. fn: function (anArray){
  3813. var self=this;
  3814. return smalltalk.withContext(function($ctx1) { var $1;
  3815. $1=_st(self)._propertyAt_put_("dependencies",anArray);
  3816. return $1;
  3817. }, function($ctx1) {$ctx1.fill(self,"dependencies:",{anArray:anArray}, smalltalk.Package)})},
  3818. args: ["anArray"],
  3819. source: "dependencies: anArray\x0a\x09^self propertyAt: 'dependencies' put: anArray",
  3820. messageSends: ["propertyAt:put:"],
  3821. referencedClasses: []
  3822. }),
  3823. smalltalk.Package);
  3824. smalltalk.addMethod(
  3825. "_jsProperties",
  3826. smalltalk.method({
  3827. selector: "jsProperties",
  3828. category: 'private',
  3829. fn: function (){
  3830. var self=this;
  3831. return smalltalk.withContext(function($ctx1) { return self.properties;
  3832. return self}, function($ctx1) {$ctx1.fill(self,"jsProperties",{}, smalltalk.Package)})},
  3833. args: [],
  3834. source: "jsProperties\x0a\x09<return self.properties>",
  3835. messageSends: [],
  3836. referencedClasses: []
  3837. }),
  3838. smalltalk.Package);
  3839. smalltalk.addMethod(
  3840. "_jsProperties_",
  3841. smalltalk.method({
  3842. selector: "jsProperties:",
  3843. category: 'private',
  3844. fn: function (aJSObject){
  3845. var self=this;
  3846. return smalltalk.withContext(function($ctx1) { return self.properties = aJSObject;
  3847. return self}, function($ctx1) {$ctx1.fill(self,"jsProperties:",{aJSObject:aJSObject}, smalltalk.Package)})},
  3848. args: ["aJSObject"],
  3849. source: "jsProperties: aJSObject\x0a\x09<return self.properties = aJSObject>",
  3850. messageSends: [],
  3851. referencedClasses: []
  3852. }),
  3853. smalltalk.Package);
  3854. smalltalk.addMethod(
  3855. "_name",
  3856. smalltalk.method({
  3857. selector: "name",
  3858. category: 'accessing',
  3859. fn: function (){
  3860. var self=this;
  3861. return smalltalk.withContext(function($ctx1) { return self.pkgName;
  3862. return self}, function($ctx1) {$ctx1.fill(self,"name",{}, smalltalk.Package)})},
  3863. args: [],
  3864. source: "name\x0a\x09<return self.pkgName>",
  3865. messageSends: [],
  3866. referencedClasses: []
  3867. }),
  3868. smalltalk.Package);
  3869. smalltalk.addMethod(
  3870. "_name_",
  3871. smalltalk.method({
  3872. selector: "name:",
  3873. category: 'accessing',
  3874. fn: function (aString){
  3875. var self=this;
  3876. return smalltalk.withContext(function($ctx1) { self.pkgName = aString;
  3877. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString}, smalltalk.Package)})},
  3878. args: ["aString"],
  3879. source: "name: aString\x0a\x09<self.pkgName = aString>",
  3880. messageSends: [],
  3881. referencedClasses: []
  3882. }),
  3883. smalltalk.Package);
  3884. smalltalk.addMethod(
  3885. "_organization",
  3886. smalltalk.method({
  3887. selector: "organization",
  3888. category: 'accessing',
  3889. fn: function (){
  3890. var self=this;
  3891. return smalltalk.withContext(function($ctx1) { var $1;
  3892. $1=_st(self)._basicAt_("organization");
  3893. return $1;
  3894. }, function($ctx1) {$ctx1.fill(self,"organization",{}, smalltalk.Package)})},
  3895. args: [],
  3896. source: "organization\x0a\x09^ self basicAt: 'organization'",
  3897. messageSends: ["basicAt:"],
  3898. referencedClasses: []
  3899. }),
  3900. smalltalk.Package);
  3901. smalltalk.addMethod(
  3902. "_printString",
  3903. smalltalk.method({
  3904. selector: "printString",
  3905. category: 'printing',
  3906. fn: function (){
  3907. var self=this;
  3908. return smalltalk.withContext(function($ctx1) { var $1;
  3909. $1=_st(self)._name();
  3910. return $1;
  3911. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Package)})},
  3912. args: [],
  3913. source: "printString\x0a\x09^self name",
  3914. messageSends: ["name"],
  3915. referencedClasses: []
  3916. }),
  3917. smalltalk.Package);
  3918. smalltalk.addMethod(
  3919. "_properties",
  3920. smalltalk.method({
  3921. selector: "properties",
  3922. category: 'accessing',
  3923. fn: function (){
  3924. var self=this;
  3925. return smalltalk.withContext(function($ctx1) { var $1;
  3926. $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._readJSObject_(_st(self)._basicAt_("properties"));
  3927. return $1;
  3928. }, function($ctx1) {$ctx1.fill(self,"properties",{}, smalltalk.Package)})},
  3929. args: [],
  3930. source: "properties\x0a\x09^Smalltalk current readJSObject: (self basicAt: 'properties')",
  3931. messageSends: ["readJSObject:", "basicAt:", "current"],
  3932. referencedClasses: ["Smalltalk"]
  3933. }),
  3934. smalltalk.Package);
  3935. smalltalk.addMethod(
  3936. "_propertiesAsJSON",
  3937. smalltalk.method({
  3938. selector: "propertiesAsJSON",
  3939. category: 'private',
  3940. fn: function (){
  3941. var self=this;
  3942. return smalltalk.withContext(function($ctx1) { return JSON.stringify(self.properties);
  3943. return self}, function($ctx1) {$ctx1.fill(self,"propertiesAsJSON",{}, smalltalk.Package)})},
  3944. args: [],
  3945. source: "propertiesAsJSON\x0a\x09<return JSON.stringify(self.properties)>",
  3946. messageSends: [],
  3947. referencedClasses: []
  3948. }),
  3949. smalltalk.Package);
  3950. smalltalk.addMethod(
  3951. "_propertyAt_",
  3952. smalltalk.method({
  3953. selector: "propertyAt:",
  3954. category: 'properties',
  3955. fn: function (key){
  3956. var self=this;
  3957. return smalltalk.withContext(function($ctx1) { return self.properties[key];
  3958. return self}, function($ctx1) {$ctx1.fill(self,"propertyAt:",{key:key}, smalltalk.Package)})},
  3959. args: ["key"],
  3960. source: "propertyAt: key\x0a\x0a\x09<return self.properties[key]>",
  3961. messageSends: [],
  3962. referencedClasses: []
  3963. }),
  3964. smalltalk.Package);
  3965. smalltalk.addMethod(
  3966. "_propertyAt_ifAbsent_",
  3967. smalltalk.method({
  3968. selector: "propertyAt:ifAbsent:",
  3969. category: 'properties',
  3970. fn: function (key,block){
  3971. var self=this;
  3972. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3973. $2=_st(self)._propertyAt_(key);
  3974. if(($receiver = $2) == nil || $receiver == undefined){
  3975. $1=_st(block)._value();
  3976. } else {
  3977. $1=$2;
  3978. };
  3979. return $1;
  3980. }, function($ctx1) {$ctx1.fill(self,"propertyAt:ifAbsent:",{key:key,block:block}, smalltalk.Package)})},
  3981. args: ["key", "block"],
  3982. source: "propertyAt: key ifAbsent: block\x0a\x0a\x09^(self propertyAt: key) ifNil: [block value]",
  3983. messageSends: ["ifNil:", "value", "propertyAt:"],
  3984. referencedClasses: []
  3985. }),
  3986. smalltalk.Package);
  3987. smalltalk.addMethod(
  3988. "_propertyAt_put_",
  3989. smalltalk.method({
  3990. selector: "propertyAt:put:",
  3991. category: 'properties',
  3992. fn: function (key,value){
  3993. var self=this;
  3994. return smalltalk.withContext(function($ctx1) { return self.properties[key] = value;
  3995. return self}, function($ctx1) {$ctx1.fill(self,"propertyAt:put:",{key:key,value:value}, smalltalk.Package)})},
  3996. args: ["key", "value"],
  3997. source: "propertyAt: key put: value\x0a\x0a\x09<return self.properties[key] = value>",
  3998. messageSends: [],
  3999. referencedClasses: []
  4000. }),
  4001. smalltalk.Package);
  4002. smalltalk.addMethod(
  4003. "_setupClasses",
  4004. smalltalk.method({
  4005. selector: "setupClasses",
  4006. category: 'classes',
  4007. fn: function (){
  4008. var self=this;
  4009. return smalltalk.withContext(function($ctx1) { var $1,$2;
  4010. $1=_st(self)._classes();
  4011. _st($1)._do_((function(each){
  4012. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._setupClass_(each);
  4013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4014. $2=_st($1)._do_((function(each){
  4015. return smalltalk.withContext(function($ctx2) { return _st(each)._initialize();
  4016. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4017. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{}, smalltalk.Package)})},
  4018. args: [],
  4019. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  4020. messageSends: ["do:", "setupClass:", "new", "classes", "initialize"],
  4021. referencedClasses: ["ClassBuilder"]
  4022. }),
  4023. smalltalk.Package);
  4024. smalltalk.addMethod(
  4025. "_sortedClasses",
  4026. smalltalk.method({
  4027. selector: "sortedClasses",
  4028. category: 'classes',
  4029. fn: function (){
  4030. var self=this;
  4031. return smalltalk.withContext(function($ctx1) { var $1;
  4032. $1=_st(_st(self)._class())._sortedClasses_(_st(self)._classes());
  4033. return $1;
  4034. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{}, smalltalk.Package)})},
  4035. args: [],
  4036. 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",
  4037. messageSends: ["sortedClasses:", "classes", "class"],
  4038. referencedClasses: []
  4039. }),
  4040. smalltalk.Package);
  4041. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  4042. smalltalk.addMethod(
  4043. "_commitPathsFromLoader",
  4044. smalltalk.method({
  4045. selector: "commitPathsFromLoader",
  4046. category: 'commit paths',
  4047. fn: function (){
  4048. var self=this;
  4049. return smalltalk.withContext(function($ctx1) {
  4050. var cp = smalltalk['@@commitPath'];
  4051. if (!cp) return;
  4052. if (cp.js) self._defaultCommitPathJs_(cp.js);
  4053. if (cp.st) self._defaultCommitPathSt_(cp.st);
  4054. ;
  4055. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{}, smalltalk.Package.klass)})},
  4056. args: [],
  4057. source: "commitPathsFromLoader\x0a <\x0a var cp = smalltalk['@@commitPath'];\x0a if (!cp) return;\x0a if (cp.js) self._defaultCommitPathJs_(cp.js);\x0a if (cp.st) self._defaultCommitPathSt_(cp.st);\x0a >",
  4058. messageSends: [],
  4059. referencedClasses: []
  4060. }),
  4061. smalltalk.Package.klass);
  4062. smalltalk.addMethod(
  4063. "_defaultCommitPathJs",
  4064. smalltalk.method({
  4065. selector: "defaultCommitPathJs",
  4066. category: 'commit paths',
  4067. fn: function (){
  4068. var self=this;
  4069. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4070. $2=self["@defaultCommitPathJs"];
  4071. if(($receiver = $2) == nil || $receiver == undefined){
  4072. self["@defaultCommitPathJs"]="js";
  4073. $1=self["@defaultCommitPathJs"];
  4074. } else {
  4075. $1=$2;
  4076. };
  4077. return $1;
  4078. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{}, smalltalk.Package.klass)})},
  4079. args: [],
  4080. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  4081. messageSends: ["ifNil:"],
  4082. referencedClasses: []
  4083. }),
  4084. smalltalk.Package.klass);
  4085. smalltalk.addMethod(
  4086. "_defaultCommitPathJs_",
  4087. smalltalk.method({
  4088. selector: "defaultCommitPathJs:",
  4089. category: 'commit paths',
  4090. fn: function (aString){
  4091. var self=this;
  4092. return smalltalk.withContext(function($ctx1) { self["@defaultCommitPathJs"]=aString;
  4093. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString}, smalltalk.Package.klass)})},
  4094. args: ["aString"],
  4095. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  4096. messageSends: [],
  4097. referencedClasses: []
  4098. }),
  4099. smalltalk.Package.klass);
  4100. smalltalk.addMethod(
  4101. "_defaultCommitPathSt",
  4102. smalltalk.method({
  4103. selector: "defaultCommitPathSt",
  4104. category: 'commit paths',
  4105. fn: function (){
  4106. var self=this;
  4107. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4108. $2=self["@defaultCommitPathSt"];
  4109. if(($receiver = $2) == nil || $receiver == undefined){
  4110. self["@defaultCommitPathSt"]="st";
  4111. $1=self["@defaultCommitPathSt"];
  4112. } else {
  4113. $1=$2;
  4114. };
  4115. return $1;
  4116. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{}, smalltalk.Package.klass)})},
  4117. args: [],
  4118. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  4119. messageSends: ["ifNil:"],
  4120. referencedClasses: []
  4121. }),
  4122. smalltalk.Package.klass);
  4123. smalltalk.addMethod(
  4124. "_defaultCommitPathSt_",
  4125. smalltalk.method({
  4126. selector: "defaultCommitPathSt:",
  4127. category: 'commit paths',
  4128. fn: function (aString){
  4129. var self=this;
  4130. return smalltalk.withContext(function($ctx1) { self["@defaultCommitPathSt"]=aString;
  4131. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString}, smalltalk.Package.klass)})},
  4132. args: ["aString"],
  4133. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  4134. messageSends: [],
  4135. referencedClasses: []
  4136. }),
  4137. smalltalk.Package.klass);
  4138. smalltalk.addMethod(
  4139. "_fetch_",
  4140. smalltalk.method({
  4141. selector: "fetch:",
  4142. category: 'loading-storing',
  4143. fn: function (aPackageName){
  4144. var self=this;
  4145. return smalltalk.withContext(function($ctx1) { _st(self)._fetch_prefix_(aPackageName,_st(_st(self)._defaultCommitPathJs()).__comma("/"));
  4146. return self}, function($ctx1) {$ctx1.fill(self,"fetch:",{aPackageName:aPackageName}, smalltalk.Package.klass)})},
  4147. args: ["aPackageName"],
  4148. source: "fetch: aPackageName\x0a\x09self fetch: aPackageName prefix: self defaultCommitPathJs, '/'",
  4149. messageSends: ["fetch:prefix:", ",", "defaultCommitPathJs"],
  4150. referencedClasses: []
  4151. }),
  4152. smalltalk.Package.klass);
  4153. smalltalk.addMethod(
  4154. "_fetch_prefix_",
  4155. smalltalk.method({
  4156. selector: "fetch:prefix:",
  4157. category: 'loading-storing',
  4158. fn: function (aPackageName,aPrefix){
  4159. var self=this;
  4160. return smalltalk.withContext(function($ctx1) { _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){
  4161. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Package || Package))._named_(aPackageName))._setupClasses();
  4162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4163. return self}, function($ctx1) {$ctx1.fill(self,"fetch:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix}, smalltalk.Package.klass)})},
  4164. args: ["aPackageName", "aPrefix"],
  4165. source: "fetch: aPackageName prefix: aPrefix\x0a\x09jQuery \x0a \x09getScript: (aPrefix , aPackageName , '.js') \x0a onSuccess: [ \x0a \x09(Package named: aPackageName) setupClasses ]",
  4166. messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"],
  4167. referencedClasses: ["Package"]
  4168. }),
  4169. smalltalk.Package.klass);
  4170. smalltalk.addMethod(
  4171. "_initialize",
  4172. smalltalk.method({
  4173. selector: "initialize",
  4174. category: 'initialization',
  4175. fn: function (){
  4176. var self=this;
  4177. return smalltalk.withContext(function($ctx1) { smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []);
  4178. _st(self)._commitPathsFromLoader();
  4179. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Package.klass)})},
  4180. args: [],
  4181. source: "initialize\x0a\x09super initialize.\x0a self commitPathsFromLoader",
  4182. messageSends: ["initialize", "commitPathsFromLoader"],
  4183. referencedClasses: []
  4184. }),
  4185. smalltalk.Package.klass);
  4186. smalltalk.addMethod(
  4187. "_named_",
  4188. smalltalk.method({
  4189. selector: "named:",
  4190. category: 'accessing',
  4191. fn: function (aPackageName){
  4192. var self=this;
  4193. return smalltalk.withContext(function($ctx1) { var $1;
  4194. $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packageAt_(aPackageName);
  4195. return $1;
  4196. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName}, smalltalk.Package.klass)})},
  4197. args: ["aPackageName"],
  4198. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  4199. messageSends: ["packageAt:", "current"],
  4200. referencedClasses: ["Smalltalk"]
  4201. }),
  4202. smalltalk.Package.klass);
  4203. smalltalk.addMethod(
  4204. "_named_ifAbsent_",
  4205. smalltalk.method({
  4206. selector: "named:ifAbsent:",
  4207. category: 'accessing',
  4208. fn: function (aPackageName,aBlock){
  4209. var self=this;
  4210. return smalltalk.withContext(function($ctx1) { var $1;
  4211. $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  4212. return $1;
  4213. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock}, smalltalk.Package.klass)})},
  4214. args: ["aPackageName", "aBlock"],
  4215. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  4216. messageSends: ["packageAt:ifAbsent:", "current"],
  4217. referencedClasses: ["Smalltalk"]
  4218. }),
  4219. smalltalk.Package.klass);
  4220. smalltalk.addMethod(
  4221. "_resetCommitPaths",
  4222. smalltalk.method({
  4223. selector: "resetCommitPaths",
  4224. category: 'commit paths',
  4225. fn: function (){
  4226. var self=this;
  4227. return smalltalk.withContext(function($ctx1) { self["@defaultCommitPathJs"]=nil;
  4228. self["@defaultCommitPathSt"]=nil;
  4229. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{}, smalltalk.Package.klass)})},
  4230. args: [],
  4231. source: "resetCommitPaths\x0a defaultCommitPathJs := nil.\x0a defaultCommitPathSt := nil.",
  4232. messageSends: [],
  4233. referencedClasses: []
  4234. }),
  4235. smalltalk.Package.klass);
  4236. smalltalk.addMethod(
  4237. "_sortedClasses_",
  4238. smalltalk.method({
  4239. selector: "sortedClasses:",
  4240. category: 'sorting',
  4241. fn: function (classes){
  4242. var self=this;
  4243. var children,others,nodes,expandedClasses;
  4244. return smalltalk.withContext(function($ctx1) { var $1,$2;
  4245. children=[];
  4246. others=[];
  4247. _st(classes)._do_((function(each){
  4248. return smalltalk.withContext(function($ctx2) { $1=_st(classes)._includes_(_st(each)._superclass());
  4249. if(smalltalk.assert($1)){
  4250. return _st(others)._add_(each);
  4251. } else {
  4252. return _st(children)._add_(each);
  4253. };
  4254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4255. nodes=_st(children)._collect_((function(each){
  4256. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.ClassSorterNode || ClassSorterNode))._on_classes_level_(each,others,(0));
  4257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4258. nodes=_st(nodes)._sorted_((function(a,b){
  4259. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  4260. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  4261. expandedClasses=_st((smalltalk.Array || Array))._new();
  4262. _st(nodes)._do_((function(aNode){
  4263. return smalltalk.withContext(function($ctx2) { return _st(aNode)._traverseClassesWith_(expandedClasses);
  4264. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  4265. $2=expandedClasses;
  4266. return $2;
  4267. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses}, smalltalk.Package.klass)})},
  4268. args: ["classes"],
  4269. 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",
  4270. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  4271. referencedClasses: ["ClassSorterNode", "Array"]
  4272. }),
  4273. smalltalk.Package.klass);
  4274. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  4275. smalltalk.Point.comment="A `Point` represents an x-y pair of numbers usually designating a geometric coordinate.\x0aPoints are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a Point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22\x0a\x0aAmber does not have much behavior in this class out-of-the-box."
  4276. smalltalk.addMethod(
  4277. "__star",
  4278. smalltalk.method({
  4279. selector: "*",
  4280. category: 'arithmetic',
  4281. fn: function (aPoint){
  4282. var self=this;
  4283. return smalltalk.withContext(function($ctx1) { var $1;
  4284. $1=_st((smalltalk.Point || Point))._x_y_(_st(_st(self)._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__star(_st(_st(aPoint)._asPoint())._y()));
  4285. return $1;
  4286. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint}, smalltalk.Point)})},
  4287. args: ["aPoint"],
  4288. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4289. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4290. referencedClasses: ["Point"]
  4291. }),
  4292. smalltalk.Point);
  4293. smalltalk.addMethod(
  4294. "__plus",
  4295. smalltalk.method({
  4296. selector: "+",
  4297. category: 'arithmetic',
  4298. fn: function (aPoint){
  4299. var self=this;
  4300. return smalltalk.withContext(function($ctx1) { var $1;
  4301. $1=_st((smalltalk.Point || Point))._x_y_(_st(_st(self)._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
  4302. return $1;
  4303. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint}, smalltalk.Point)})},
  4304. args: ["aPoint"],
  4305. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4306. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4307. referencedClasses: ["Point"]
  4308. }),
  4309. smalltalk.Point);
  4310. smalltalk.addMethod(
  4311. "__minus",
  4312. smalltalk.method({
  4313. selector: "-",
  4314. category: 'arithmetic',
  4315. fn: function (aPoint){
  4316. var self=this;
  4317. return smalltalk.withContext(function($ctx1) { var $1;
  4318. $1=_st((smalltalk.Point || Point))._x_y_(_st(_st(self)._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
  4319. return $1;
  4320. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint}, smalltalk.Point)})},
  4321. args: ["aPoint"],
  4322. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4323. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4324. referencedClasses: ["Point"]
  4325. }),
  4326. smalltalk.Point);
  4327. smalltalk.addMethod(
  4328. "__slash",
  4329. smalltalk.method({
  4330. selector: "/",
  4331. category: 'arithmetic',
  4332. fn: function (aPoint){
  4333. var self=this;
  4334. return smalltalk.withContext(function($ctx1) { var $1;
  4335. $1=_st((smalltalk.Point || Point))._x_y_(_st(_st(self)._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
  4336. return $1;
  4337. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint}, smalltalk.Point)})},
  4338. args: ["aPoint"],
  4339. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4340. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4341. referencedClasses: ["Point"]
  4342. }),
  4343. smalltalk.Point);
  4344. smalltalk.addMethod(
  4345. "__eq",
  4346. smalltalk.method({
  4347. selector: "=",
  4348. category: 'arithmetic',
  4349. fn: function (aPoint){
  4350. var self=this;
  4351. return smalltalk.withContext(function($ctx1) { var $1;
  4352. $1=_st(_st(_st(aPoint)._class()).__eq(_st(self)._class()))._and_((function(){
  4353. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(aPoint)._x()).__eq(_st(self)._x())).__and(_st(_st(aPoint)._y()).__eq(_st(self)._y()));
  4354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4355. return $1;
  4356. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint}, smalltalk.Point)})},
  4357. args: ["aPoint"],
  4358. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  4359. messageSends: ["and:", "&", "=", "y", "x", "class"],
  4360. referencedClasses: []
  4361. }),
  4362. smalltalk.Point);
  4363. smalltalk.addMethod(
  4364. "_asPoint",
  4365. smalltalk.method({
  4366. selector: "asPoint",
  4367. category: 'converting',
  4368. fn: function (){
  4369. var self=this;
  4370. return smalltalk.withContext(function($ctx1) { var $1;
  4371. $1=self;
  4372. return $1;
  4373. }, function($ctx1) {$ctx1.fill(self,"asPoint",{}, smalltalk.Point)})},
  4374. args: [],
  4375. source: "asPoint\x0a\x09^self",
  4376. messageSends: [],
  4377. referencedClasses: []
  4378. }),
  4379. smalltalk.Point);
  4380. smalltalk.addMethod(
  4381. "_printString",
  4382. smalltalk.method({
  4383. selector: "printString",
  4384. category: 'printing',
  4385. fn: function (){
  4386. var self=this;
  4387. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4388. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  4389. return smalltalk.withContext(function($ctx2) { _st(stream)._nextPutAll_(_st(_st(self["@x"])._printString()).__comma("@"));
  4390. $2=_st(_st(self["@y"])._notNil())._and_((function(){
  4391. return smalltalk.withContext(function($ctx3) { return _st(self["@y"])._negative();
  4392. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  4393. if(smalltalk.assert($2)){
  4394. _st(stream)._space();
  4395. };
  4396. return _st(stream)._nextPutAll_(_st(self["@y"])._printString());
  4397. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  4398. return $1;
  4399. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Point)})},
  4400. args: [],
  4401. source: "printString\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09stream nextPutAll: x printString, '@'.\x0a\x09\x09(y notNil and: [y negative])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09\x09stream space].\x0a\x09\x09stream nextPutAll: y printString]",
  4402. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "ifTrue:", "space", "and:", "negative", "notNil"],
  4403. referencedClasses: ["String"]
  4404. }),
  4405. smalltalk.Point);
  4406. smalltalk.addMethod(
  4407. "_translateBy_",
  4408. smalltalk.method({
  4409. selector: "translateBy:",
  4410. category: 'transforming',
  4411. fn: function (delta){
  4412. var self=this;
  4413. return smalltalk.withContext(function($ctx1) { var $1;
  4414. $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  4415. return $1;
  4416. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta}, smalltalk.Point)})},
  4417. args: ["delta"],
  4418. source: "translateBy: delta \x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  4419. messageSends: ["@", "+", "y", "x"],
  4420. referencedClasses: []
  4421. }),
  4422. smalltalk.Point);
  4423. smalltalk.addMethod(
  4424. "_x",
  4425. smalltalk.method({
  4426. selector: "x",
  4427. category: 'accessing',
  4428. fn: function (){
  4429. var self=this;
  4430. return smalltalk.withContext(function($ctx1) { var $1;
  4431. $1=self["@x"];
  4432. return $1;
  4433. }, function($ctx1) {$ctx1.fill(self,"x",{}, smalltalk.Point)})},
  4434. args: [],
  4435. source: "x\x0a\x09^x",
  4436. messageSends: [],
  4437. referencedClasses: []
  4438. }),
  4439. smalltalk.Point);
  4440. smalltalk.addMethod(
  4441. "_x_",
  4442. smalltalk.method({
  4443. selector: "x:",
  4444. category: 'accessing',
  4445. fn: function (aNumber){
  4446. var self=this;
  4447. return smalltalk.withContext(function($ctx1) { self["@x"]=aNumber;
  4448. return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber}, smalltalk.Point)})},
  4449. args: ["aNumber"],
  4450. source: "x: aNumber\x0a\x09x := aNumber",
  4451. messageSends: [],
  4452. referencedClasses: []
  4453. }),
  4454. smalltalk.Point);
  4455. smalltalk.addMethod(
  4456. "_y",
  4457. smalltalk.method({
  4458. selector: "y",
  4459. category: 'accessing',
  4460. fn: function (){
  4461. var self=this;
  4462. return smalltalk.withContext(function($ctx1) { var $1;
  4463. $1=self["@y"];
  4464. return $1;
  4465. }, function($ctx1) {$ctx1.fill(self,"y",{}, smalltalk.Point)})},
  4466. args: [],
  4467. source: "y\x0a\x09^y",
  4468. messageSends: [],
  4469. referencedClasses: []
  4470. }),
  4471. smalltalk.Point);
  4472. smalltalk.addMethod(
  4473. "_y_",
  4474. smalltalk.method({
  4475. selector: "y:",
  4476. category: 'accessing',
  4477. fn: function (aNumber){
  4478. var self=this;
  4479. return smalltalk.withContext(function($ctx1) { self["@y"]=aNumber;
  4480. return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber}, smalltalk.Point)})},
  4481. args: ["aNumber"],
  4482. source: "y: aNumber\x0a\x09y := aNumber",
  4483. messageSends: [],
  4484. referencedClasses: []
  4485. }),
  4486. smalltalk.Point);
  4487. smalltalk.addMethod(
  4488. "_x_y_",
  4489. smalltalk.method({
  4490. selector: "x:y:",
  4491. category: 'instance creation',
  4492. fn: function (aNumber,anotherNumber){
  4493. var self=this;
  4494. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  4495. $2=_st(self)._new();
  4496. _st($2)._x_(aNumber);
  4497. _st($2)._y_(anotherNumber);
  4498. $3=_st($2)._yourself();
  4499. $1=$3;
  4500. return $1;
  4501. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber}, smalltalk.Point.klass)})},
  4502. args: ["aNumber", "anotherNumber"],
  4503. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4504. messageSends: ["x:", "new", "y:", "yourself"],
  4505. referencedClasses: []
  4506. }),
  4507. smalltalk.Point.klass);
  4508. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  4509. smalltalk.Random.comment="`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0a...and if you want a random number in a specific interval this also works:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0a...but be aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0a...or perhaps a letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`."
  4510. smalltalk.addMethod(
  4511. "_next",
  4512. smalltalk.method({
  4513. selector: "next",
  4514. category: 'accessing',
  4515. fn: function (){
  4516. var self=this;
  4517. return smalltalk.withContext(function($ctx1) { return Math.random();
  4518. return self}, function($ctx1) {$ctx1.fill(self,"next",{}, smalltalk.Random)})},
  4519. args: [],
  4520. source: "next\x0a\x09<return Math.random()>",
  4521. messageSends: [],
  4522. referencedClasses: []
  4523. }),
  4524. smalltalk.Random);
  4525. smalltalk.addMethod(
  4526. "_next_",
  4527. smalltalk.method({
  4528. selector: "next:",
  4529. category: 'accessing',
  4530. fn: function (anInteger){
  4531. var self=this;
  4532. return smalltalk.withContext(function($ctx1) { var $1;
  4533. $1=_st(_st((1))._to_(anInteger))._collect_((function(each){
  4534. return smalltalk.withContext(function($ctx2) { return _st(self)._next();
  4535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4536. return $1;
  4537. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger}, smalltalk.Random)})},
  4538. args: ["anInteger"],
  4539. source: "next: anInteger\x0a ^(1 to: anInteger) collect: [:each | self next]",
  4540. messageSends: ["collect:", "next", "to:"],
  4541. referencedClasses: []
  4542. }),
  4543. smalltalk.Random);
  4544. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  4545. smalltalk.Smalltalk.comment="Smalltalk has only one instance, accessed with `Smalltalk current`. \x0aIt represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class of `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific class of `nil`\x0a\x0a__note:__ classes and packages are accessed using strings, not symbols\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Smalltalk source code. \x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work"
  4546. smalltalk.addMethod(
  4547. "_asSmalltalkException_",
  4548. smalltalk.method({
  4549. selector: "asSmalltalkException:",
  4550. category: 'error handling',
  4551. fn: function (anObject){
  4552. var self=this;
  4553. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4554. $2=_st(_st(self)._isSmalltalkObject_(anObject))._and_((function(){
  4555. return smalltalk.withContext(function($ctx2) { return _st(anObject)._isKindOf_((smalltalk.Error || Error));
  4556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4557. if(smalltalk.assert($2)){
  4558. $1=anObject;
  4559. } else {
  4560. $1=_st((smalltalk.JavaScriptException || JavaScriptException))._on_(anObject);
  4561. };
  4562. return $1;
  4563. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject}, smalltalk.Smalltalk)})},
  4564. args: ["anObject"],
  4565. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a We then need to convert it back to a Smalltalk object\x22\x0a \x0a ^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a \x09ifTrue: [ anObject ]\x0a \x09ifFalse: [ JavaScriptException on: anObject ]",
  4566. messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"],
  4567. referencedClasses: ["JavaScriptException", "Error"]
  4568. }),
  4569. smalltalk.Smalltalk);
  4570. smalltalk.addMethod(
  4571. "_at_",
  4572. smalltalk.method({
  4573. selector: "at:",
  4574. category: 'accessing',
  4575. fn: function (aSymbol){
  4576. var self=this;
  4577. return smalltalk.withContext(function($ctx1) { return self[aSymbol._asString()];
  4578. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aSymbol:aSymbol}, smalltalk.Smalltalk)})},
  4579. args: ["aSymbol"],
  4580. source: "at: aSymbol\x0a\x09<return self[aSymbol._asString()]>",
  4581. messageSends: [],
  4582. referencedClasses: []
  4583. }),
  4584. smalltalk.Smalltalk);
  4585. smalltalk.addMethod(
  4586. "_basicParse_",
  4587. smalltalk.method({
  4588. selector: "basicParse:",
  4589. category: 'private',
  4590. fn: function (aString){
  4591. var self=this;
  4592. return smalltalk.withContext(function($ctx1) { return smalltalk.parser.parse(aString);
  4593. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString}, smalltalk.Smalltalk)})},
  4594. args: ["aString"],
  4595. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  4596. messageSends: [],
  4597. referencedClasses: []
  4598. }),
  4599. smalltalk.Smalltalk);
  4600. smalltalk.addMethod(
  4601. "_classes",
  4602. smalltalk.method({
  4603. selector: "classes",
  4604. category: 'classes',
  4605. fn: function (){
  4606. var self=this;
  4607. return smalltalk.withContext(function($ctx1) { return self.classes();
  4608. return self}, function($ctx1) {$ctx1.fill(self,"classes",{}, smalltalk.Smalltalk)})},
  4609. args: [],
  4610. source: "classes\x0a\x09<return self.classes()>",
  4611. messageSends: [],
  4612. referencedClasses: []
  4613. }),
  4614. smalltalk.Smalltalk);
  4615. smalltalk.addMethod(
  4616. "_createPackage_",
  4617. smalltalk.method({
  4618. selector: "createPackage:",
  4619. category: 'packages',
  4620. fn: function (packageName){
  4621. var self=this;
  4622. return smalltalk.withContext(function($ctx1) { return smalltalk.addPackage(packageName);
  4623. return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName}, smalltalk.Smalltalk)})},
  4624. args: ["packageName"],
  4625. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a <return smalltalk.addPackage(packageName)>",
  4626. messageSends: [],
  4627. referencedClasses: []
  4628. }),
  4629. smalltalk.Smalltalk);
  4630. smalltalk.addMethod(
  4631. "_createPackage_properties_",
  4632. smalltalk.method({
  4633. selector: "createPackage:properties:",
  4634. category: 'private',
  4635. fn: function (packageName,aDict){
  4636. var self=this;
  4637. return smalltalk.withContext(function($ctx1) { var $1,$2;
  4638. _st(self)._deprecatedAPI();
  4639. $1=_st(aDict)._isEmpty();
  4640. if(! smalltalk.assert($1)){
  4641. _st(self)._error_("createPackage:properties: called with nonempty properties");
  4642. };
  4643. $2=_st(self)._createPackage_(packageName);
  4644. return $2;
  4645. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict}, smalltalk.Smalltalk)})},
  4646. args: ["packageName", "aDict"],
  4647. source: "createPackage: packageName properties: aDict\x0a \x22Needed to import .st files: they begin with this call.\x22\x0a self deprecatedAPI.\x0a \x0a aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a ^ self createPackage: packageName",
  4648. messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"],
  4649. referencedClasses: []
  4650. }),
  4651. smalltalk.Smalltalk);
  4652. smalltalk.addMethod(
  4653. "_deleteClass_",
  4654. smalltalk.method({
  4655. selector: "deleteClass:",
  4656. category: 'classes',
  4657. fn: function (aClass){
  4658. var self=this;
  4659. return smalltalk.withContext(function($ctx1) { self.removeClass(aClass);
  4660. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass}, smalltalk.Smalltalk)})},
  4661. args: ["aClass"],
  4662. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a \x0a\x09<self.removeClass(aClass)>",
  4663. messageSends: [],
  4664. referencedClasses: []
  4665. }),
  4666. smalltalk.Smalltalk);
  4667. smalltalk.addMethod(
  4668. "_deletePackage_",
  4669. smalltalk.method({
  4670. selector: "deletePackage:",
  4671. category: 'packages',
  4672. fn: function (packageName){
  4673. var self=this;
  4674. return smalltalk.withContext(function($ctx1) { delete smalltalk.packages[packageName];
  4675. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName}, smalltalk.Smalltalk)})},
  4676. args: ["packageName"],
  4677. 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 <delete smalltalk.packages[packageName]>",
  4678. messageSends: [],
  4679. referencedClasses: []
  4680. }),
  4681. smalltalk.Smalltalk);
  4682. smalltalk.addMethod(
  4683. "_isSmalltalkObject_",
  4684. smalltalk.method({
  4685. selector: "isSmalltalkObject:",
  4686. category: 'testing',
  4687. fn: function (anObject){
  4688. var self=this;
  4689. return smalltalk.withContext(function($ctx1) { return typeof anObject.klass !== 'undefined';
  4690. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject}, smalltalk.Smalltalk)})},
  4691. args: ["anObject"],
  4692. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a Note that this may be unaccurate\x22\x0a \x0a <return typeof anObject.klass !== 'undefined'>",
  4693. messageSends: [],
  4694. referencedClasses: []
  4695. }),
  4696. smalltalk.Smalltalk);
  4697. smalltalk.addMethod(
  4698. "_packageAt_",
  4699. smalltalk.method({
  4700. selector: "packageAt:",
  4701. category: 'packages',
  4702. fn: function (packageName){
  4703. var self=this;
  4704. return smalltalk.withContext(function($ctx1) { return self.packages[packageName];
  4705. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName}, smalltalk.Smalltalk)})},
  4706. args: ["packageName"],
  4707. source: "packageAt: packageName\x0a <return self.packages[packageName]>",
  4708. messageSends: [],
  4709. referencedClasses: []
  4710. }),
  4711. smalltalk.Smalltalk);
  4712. smalltalk.addMethod(
  4713. "_packageAt_ifAbsent_",
  4714. smalltalk.method({
  4715. selector: "packageAt:ifAbsent:",
  4716. category: 'packages',
  4717. fn: function (packageName,aBlock){
  4718. var self=this;
  4719. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4720. $2=_st(self)._packageAt_(packageName);
  4721. $1=_st($2)._ifNil_(aBlock);
  4722. return $1;
  4723. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock}, smalltalk.Smalltalk)})},
  4724. args: ["packageName", "aBlock"],
  4725. source: "packageAt: packageName ifAbsent: aBlock\x0a ^(self packageAt: packageName) ifNil: aBlock",
  4726. messageSends: ["ifNil:", "packageAt:"],
  4727. referencedClasses: []
  4728. }),
  4729. smalltalk.Smalltalk);
  4730. smalltalk.addMethod(
  4731. "_packages",
  4732. smalltalk.method({
  4733. selector: "packages",
  4734. category: 'packages',
  4735. fn: function (){
  4736. var self=this;
  4737. return smalltalk.withContext(function($ctx1) { return self.packages.all();
  4738. return self}, function($ctx1) {$ctx1.fill(self,"packages",{}, smalltalk.Smalltalk)})},
  4739. args: [],
  4740. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  4741. messageSends: [],
  4742. referencedClasses: []
  4743. }),
  4744. smalltalk.Smalltalk);
  4745. smalltalk.addMethod(
  4746. "_parse_",
  4747. smalltalk.method({
  4748. selector: "parse:",
  4749. category: 'accessing',
  4750. fn: function (aString){
  4751. var self=this;
  4752. var result;
  4753. return smalltalk.withContext(function($ctx1) { var $1;
  4754. _st(self)._try_catch_((function(){
  4755. return smalltalk.withContext(function($ctx2) { result=_st(self)._basicParse_(aString);
  4756. return result;
  4757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){
  4758. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._parseError_parsing_(ex,aString))._signal();
  4759. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  4760. $1=result;
  4761. return $1;
  4762. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result}, smalltalk.Smalltalk)})},
  4763. args: ["aString"],
  4764. source: "parse: aString\x0a\x09| result | \x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  4765. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  4766. referencedClasses: []
  4767. }),
  4768. smalltalk.Smalltalk);
  4769. smalltalk.addMethod(
  4770. "_parseError_parsing_",
  4771. smalltalk.method({
  4772. selector: "parseError:parsing:",
  4773. category: 'error handling',
  4774. fn: function (anException,aString){
  4775. var self=this;
  4776. return smalltalk.withContext(function($ctx1) { var $1;
  4777. $1=_st(_st((smalltalk.ParseError || 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")));
  4778. return $1;
  4779. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString}, smalltalk.Smalltalk)})},
  4780. args: ["anException", "aString"],
  4781. 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')",
  4782. messageSends: ["messageText:", ",", "basicAt:", "new"],
  4783. referencedClasses: ["ParseError"]
  4784. }),
  4785. smalltalk.Smalltalk);
  4786. smalltalk.addMethod(
  4787. "_pseudoVariableNames",
  4788. smalltalk.method({
  4789. selector: "pseudoVariableNames",
  4790. category: 'packages',
  4791. fn: function (){
  4792. var self=this;
  4793. return smalltalk.withContext(function($ctx1) { return ["self", "super", "nil", "true", "false", "thisContext"];
  4794. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{}, smalltalk.Smalltalk)})},
  4795. args: [],
  4796. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  4797. messageSends: [],
  4798. referencedClasses: []
  4799. }),
  4800. smalltalk.Smalltalk);
  4801. smalltalk.addMethod(
  4802. "_readJSObject_",
  4803. smalltalk.method({
  4804. selector: "readJSObject:",
  4805. category: 'accessing',
  4806. fn: function (anObject){
  4807. var self=this;
  4808. return smalltalk.withContext(function($ctx1) { return self.readJSObject(anObject);
  4809. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject}, smalltalk.Smalltalk)})},
  4810. args: ["anObject"],
  4811. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  4812. messageSends: [],
  4813. referencedClasses: []
  4814. }),
  4815. smalltalk.Smalltalk);
  4816. smalltalk.addMethod(
  4817. "_removeClass_",
  4818. smalltalk.method({
  4819. selector: "removeClass:",
  4820. category: 'classes',
  4821. fn: function (aClass){
  4822. var self=this;
  4823. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  4824. $1=_st(aClass)._isMetaclass();
  4825. if(smalltalk.assert($1)){
  4826. _st(self)._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  4827. };
  4828. _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
  4829. return smalltalk.withContext(function($ctx2) { return _st(aClass)._removeCompiledMethod_(each);
  4830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4831. _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
  4832. return smalltalk.withContext(function($ctx2) { return _st(_st(aClass)._class())._removeCompiledMethod_(each);
  4833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4834. _st(self)._deleteClass_(aClass);
  4835. $2=_st((smalltalk.ClassRemoved || ClassRemoved))._new();
  4836. _st($2)._theClass_(aClass);
  4837. $3=_st($2)._yourself();
  4838. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($3);
  4839. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass}, smalltalk.Smalltalk)})},
  4840. args: ["aClass"],
  4841. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a \x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09aClass removeCompiledMethod: each].\x0a \x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09aClass class removeCompiledMethod: each].\x0a \x0a\x09self deleteClass: aClass.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassRemoved new\x0a \x09theClass: aClass;\x0a yourself)",
  4842. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "do:", "removeCompiledMethod:", "values", "methodDictionary", "class", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  4843. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  4844. }),
  4845. smalltalk.Smalltalk);
  4846. smalltalk.addMethod(
  4847. "_removePackage_",
  4848. smalltalk.method({
  4849. selector: "removePackage:",
  4850. category: 'packages',
  4851. fn: function (packageName){
  4852. var self=this;
  4853. var pkg;
  4854. return smalltalk.withContext(function($ctx1) { pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
  4855. return smalltalk.withContext(function($ctx2) { return _st(self)._error_(_st("Missing package: ").__comma(packageName));
  4856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4857. _st(_st(pkg)._classes())._do_((function(each){
  4858. return smalltalk.withContext(function($ctx2) { return _st(self)._removeClass_(each);
  4859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4860. _st(self)._deletePackage_(packageName);
  4861. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg}, smalltalk.Smalltalk)})},
  4862. args: ["packageName"],
  4863. 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 \x09self removeClass: each].\x0a\x09self deletePackage: packageName",
  4864. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  4865. referencedClasses: []
  4866. }),
  4867. smalltalk.Smalltalk);
  4868. smalltalk.addMethod(
  4869. "_renamePackage_to_",
  4870. smalltalk.method({
  4871. selector: "renamePackage:to:",
  4872. category: 'packages',
  4873. fn: function (packageName,newName){
  4874. var self=this;
  4875. var pkg;
  4876. return smalltalk.withContext(function($ctx1) { var $1;
  4877. pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
  4878. return smalltalk.withContext(function($ctx2) { return _st(self)._error_(_st("Missing package: ").__comma(packageName));
  4879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4880. $1=_st(self)._packageAt_(newName);
  4881. if(($receiver = $1) == nil || $receiver == undefined){
  4882. $1;
  4883. } else {
  4884. _st(self)._error_(_st("Already exists a package called: ").__comma(newName));
  4885. };
  4886. _st(_st(self)._basicAt_("packages"))._at_put_(newName,pkg);
  4887. _st(pkg)._name_(newName);
  4888. _st(self)._deletePackage_(packageName);
  4889. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg}, smalltalk.Smalltalk)})},
  4890. args: ["packageName", "newName"],
  4891. 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 (self basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  4892. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
  4893. referencedClasses: []
  4894. }),
  4895. smalltalk.Smalltalk);
  4896. smalltalk.addMethod(
  4897. "_reservedWords",
  4898. smalltalk.method({
  4899. selector: "reservedWords",
  4900. category: 'accessing',
  4901. fn: function (){
  4902. var self=this;
  4903. return smalltalk.withContext(function($ctx1) { return self.reservedWords;
  4904. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{}, smalltalk.Smalltalk)})},
  4905. args: [],
  4906. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  4907. messageSends: [],
  4908. referencedClasses: []
  4909. }),
  4910. smalltalk.Smalltalk);
  4911. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  4912. smalltalk.addMethod(
  4913. "_current",
  4914. smalltalk.method({
  4915. selector: "current",
  4916. category: 'accessing',
  4917. fn: function (){
  4918. var self=this;
  4919. return smalltalk.withContext(function($ctx1) { return smalltalk;
  4920. return self}, function($ctx1) {$ctx1.fill(self,"current",{}, smalltalk.Smalltalk.klass)})},
  4921. args: [],
  4922. source: "current\x0a\x09<return smalltalk>",
  4923. messageSends: [],
  4924. referencedClasses: []
  4925. }),
  4926. smalltalk.Smalltalk.klass);
  4927. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  4928. smalltalk.Timeout.comment="I am wrapping the returns from set{Timeout,Interval}.\x0a\x0aNumber suffices in browsers, but node.js returns an object."
  4929. smalltalk.addMethod(
  4930. "_clearInterval",
  4931. smalltalk.method({
  4932. selector: "clearInterval",
  4933. category: 'timeout/interval',
  4934. fn: function (){
  4935. var self=this;
  4936. return smalltalk.withContext(function($ctx1) {
  4937. var interval = self["@rawTimeout"];
  4938. clearInterval(interval);
  4939. ;
  4940. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{}, smalltalk.Timeout)})},
  4941. args: [],
  4942. source: "clearInterval\x0a\x09<\x0a \x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a >",
  4943. messageSends: [],
  4944. referencedClasses: []
  4945. }),
  4946. smalltalk.Timeout);
  4947. smalltalk.addMethod(
  4948. "_clearTimeout",
  4949. smalltalk.method({
  4950. selector: "clearTimeout",
  4951. category: 'timeout/interval',
  4952. fn: function (){
  4953. var self=this;
  4954. return smalltalk.withContext(function($ctx1) {
  4955. var timeout = self["@rawTimeout"];
  4956. clearTimeout(timeout);
  4957. ;
  4958. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{}, smalltalk.Timeout)})},
  4959. args: [],
  4960. source: "clearTimeout\x0a\x09<\x0a \x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a >",
  4961. messageSends: [],
  4962. referencedClasses: []
  4963. }),
  4964. smalltalk.Timeout);
  4965. smalltalk.addMethod(
  4966. "_rawTimeout_",
  4967. smalltalk.method({
  4968. selector: "rawTimeout:",
  4969. category: 'accessing',
  4970. fn: function (anObject){
  4971. var self=this;
  4972. return smalltalk.withContext(function($ctx1) { self["@rawTimeout"]=anObject;
  4973. return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject}, smalltalk.Timeout)})},
  4974. args: ["anObject"],
  4975. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  4976. messageSends: [],
  4977. referencedClasses: []
  4978. }),
  4979. smalltalk.Timeout);
  4980. smalltalk.addMethod(
  4981. "_on_",
  4982. smalltalk.method({
  4983. selector: "on:",
  4984. category: 'instance creation',
  4985. fn: function (anObject){
  4986. var self=this;
  4987. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  4988. $2=_st(self)._new();
  4989. _st($2)._rawTimeout_(anObject);
  4990. $3=_st($2)._yourself();
  4991. $1=$3;
  4992. return $1;
  4993. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject}, smalltalk.Timeout.klass)})},
  4994. args: ["anObject"],
  4995. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  4996. messageSends: ["rawTimeout:", "new", "yourself"],
  4997. referencedClasses: []
  4998. }),
  4999. smalltalk.Timeout.klass);
  5000. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  5001. smalltalk.UndefinedObject.comment="UndefinedObject describes the behavior of its sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk representation of the `undefined` JavaScript object."
  5002. smalltalk.addMethod(
  5003. "_asJSON",
  5004. smalltalk.method({
  5005. selector: "asJSON",
  5006. category: 'converting',
  5007. fn: function (){
  5008. var self=this;
  5009. return smalltalk.withContext(function($ctx1) { var $1;
  5010. $1=null;
  5011. return $1;
  5012. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.UndefinedObject)})},
  5013. args: [],
  5014. source: "asJSON\x0a\x09^null",
  5015. messageSends: [],
  5016. referencedClasses: []
  5017. }),
  5018. smalltalk.UndefinedObject);
  5019. smalltalk.addMethod(
  5020. "_deepCopy",
  5021. smalltalk.method({
  5022. selector: "deepCopy",
  5023. category: 'copying',
  5024. fn: function (){
  5025. var self=this;
  5026. return smalltalk.withContext(function($ctx1) { var $1;
  5027. $1=self;
  5028. return $1;
  5029. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.UndefinedObject)})},
  5030. args: [],
  5031. source: "deepCopy\x0a\x09^self",
  5032. messageSends: [],
  5033. referencedClasses: []
  5034. }),
  5035. smalltalk.UndefinedObject);
  5036. smalltalk.addMethod(
  5037. "_ifNil_",
  5038. smalltalk.method({
  5039. selector: "ifNil:",
  5040. category: 'testing',
  5041. fn: function (aBlock){
  5042. var self=this;
  5043. return smalltalk.withContext(function($ctx1) { var $2,$1;
  5044. $2=self;
  5045. $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
  5046. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5047. return $1;
  5048. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock}, smalltalk.UndefinedObject)})},
  5049. args: ["aBlock"],
  5050. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  5051. messageSends: ["ifNil:ifNotNil:"],
  5052. referencedClasses: []
  5053. }),
  5054. smalltalk.UndefinedObject);
  5055. smalltalk.addMethod(
  5056. "_ifNil_ifNotNil_",
  5057. smalltalk.method({
  5058. selector: "ifNil:ifNotNil:",
  5059. category: 'testing',
  5060. fn: function (aBlock,anotherBlock){
  5061. var self=this;
  5062. return smalltalk.withContext(function($ctx1) { var $1;
  5063. $1=_st(aBlock)._value();
  5064. return $1;
  5065. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.UndefinedObject)})},
  5066. args: ["aBlock", "anotherBlock"],
  5067. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  5068. messageSends: ["value"],
  5069. referencedClasses: []
  5070. }),
  5071. smalltalk.UndefinedObject);
  5072. smalltalk.addMethod(
  5073. "_ifNotNil_",
  5074. smalltalk.method({
  5075. selector: "ifNotNil:",
  5076. category: 'testing',
  5077. fn: function (aBlock){
  5078. var self=this;
  5079. return smalltalk.withContext(function($ctx1) { var $1;
  5080. $1=self;
  5081. return $1;
  5082. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock}, smalltalk.UndefinedObject)})},
  5083. args: ["aBlock"],
  5084. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  5085. messageSends: [],
  5086. referencedClasses: []
  5087. }),
  5088. smalltalk.UndefinedObject);
  5089. smalltalk.addMethod(
  5090. "_ifNotNil_ifNil_",
  5091. smalltalk.method({
  5092. selector: "ifNotNil:ifNil:",
  5093. category: 'testing',
  5094. fn: function (aBlock,anotherBlock){
  5095. var self=this;
  5096. return smalltalk.withContext(function($ctx1) { var $1;
  5097. $1=_st(anotherBlock)._value();
  5098. return $1;
  5099. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.UndefinedObject)})},
  5100. args: ["aBlock", "anotherBlock"],
  5101. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  5102. messageSends: ["value"],
  5103. referencedClasses: []
  5104. }),
  5105. smalltalk.UndefinedObject);
  5106. smalltalk.addMethod(
  5107. "_isNil",
  5108. smalltalk.method({
  5109. selector: "isNil",
  5110. category: 'testing',
  5111. fn: function (){
  5112. var self=this;
  5113. return smalltalk.withContext(function($ctx1) { return true;
  5114. }, function($ctx1) {$ctx1.fill(self,"isNil",{}, smalltalk.UndefinedObject)})},
  5115. args: [],
  5116. source: "isNil\x0a\x09^true",
  5117. messageSends: [],
  5118. referencedClasses: []
  5119. }),
  5120. smalltalk.UndefinedObject);
  5121. smalltalk.addMethod(
  5122. "_notNil",
  5123. smalltalk.method({
  5124. selector: "notNil",
  5125. category: 'testing',
  5126. fn: function (){
  5127. var self=this;
  5128. return smalltalk.withContext(function($ctx1) { return false;
  5129. }, function($ctx1) {$ctx1.fill(self,"notNil",{}, smalltalk.UndefinedObject)})},
  5130. args: [],
  5131. source: "notNil\x0a\x09^false",
  5132. messageSends: [],
  5133. referencedClasses: []
  5134. }),
  5135. smalltalk.UndefinedObject);
  5136. smalltalk.addMethod(
  5137. "_printString",
  5138. smalltalk.method({
  5139. selector: "printString",
  5140. category: 'printing',
  5141. fn: function (){
  5142. var self=this;
  5143. return smalltalk.withContext(function($ctx1) { return "nil";
  5144. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.UndefinedObject)})},
  5145. args: [],
  5146. source: "printString\x0a ^'nil'",
  5147. messageSends: [],
  5148. referencedClasses: []
  5149. }),
  5150. smalltalk.UndefinedObject);
  5151. smalltalk.addMethod(
  5152. "_shallowCopy",
  5153. smalltalk.method({
  5154. selector: "shallowCopy",
  5155. category: 'copying',
  5156. fn: function (){
  5157. var self=this;
  5158. return smalltalk.withContext(function($ctx1) { var $1;
  5159. $1=self;
  5160. return $1;
  5161. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.UndefinedObject)})},
  5162. args: [],
  5163. source: "shallowCopy\x0a\x09^self",
  5164. messageSends: [],
  5165. referencedClasses: []
  5166. }),
  5167. smalltalk.UndefinedObject);
  5168. smalltalk.addMethod(
  5169. "_subclass_instanceVariableNames_",
  5170. smalltalk.method({
  5171. selector: "subclass:instanceVariableNames:",
  5172. category: 'class creation',
  5173. fn: function (aString,anotherString){
  5174. var self=this;
  5175. return smalltalk.withContext(function($ctx1) { var $1;
  5176. $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5177. return $1;
  5178. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString}, smalltalk.UndefinedObject)})},
  5179. args: ["aString", "anotherString"],
  5180. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  5181. messageSends: ["subclass:instanceVariableNames:package:"],
  5182. referencedClasses: []
  5183. }),
  5184. smalltalk.UndefinedObject);
  5185. smalltalk.addMethod(
  5186. "_subclass_instanceVariableNames_category_",
  5187. smalltalk.method({
  5188. selector: "subclass:instanceVariableNames:category:",
  5189. category: 'class creation',
  5190. fn: function (aString,aString2,aString3){
  5191. var self=this;
  5192. return smalltalk.withContext(function($ctx1) { var $1;
  5193. _st(self)._deprecatedAPI();
  5194. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5195. return $1;
  5196. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3}, smalltalk.UndefinedObject)})},
  5197. args: ["aString", "aString2", "aString3"],
  5198. 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",
  5199. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5200. referencedClasses: []
  5201. }),
  5202. smalltalk.UndefinedObject);
  5203. smalltalk.addMethod(
  5204. "_subclass_instanceVariableNames_package_",
  5205. smalltalk.method({
  5206. selector: "subclass:instanceVariableNames:package:",
  5207. category: 'class creation',
  5208. fn: function (aString,aString2,aString3){
  5209. var self=this;
  5210. return smalltalk.withContext(function($ctx1) { var $1;
  5211. $1=_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  5212. return $1;
  5213. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3}, smalltalk.UndefinedObject)})},
  5214. args: ["aString", "aString2", "aString3"],
  5215. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5216. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  5217. referencedClasses: ["ClassBuilder"]
  5218. }),
  5219. smalltalk.UndefinedObject);
  5220. smalltalk.addMethod(
  5221. "_new",
  5222. smalltalk.method({
  5223. selector: "new",
  5224. category: 'instance creation',
  5225. fn: function (){
  5226. var self=this;
  5227. return smalltalk.withContext(function($ctx1) { _st(self)._error_("You cannot create new instances of UndefinedObject. Use nil");
  5228. return self}, function($ctx1) {$ctx1.fill(self,"new",{}, smalltalk.UndefinedObject.klass)})},
  5229. args: [],
  5230. source: "new\x0a\x09 self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5231. messageSends: ["error:"],
  5232. referencedClasses: []
  5233. }),
  5234. smalltalk.UndefinedObject.klass);
  5235. smalltalk.addPackage('Kernel-Classes', {});
  5236. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  5237. smalltalk.Behavior.comment="Behavior is the superclass of all class objects. \x0a\x0aIt defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0aInstances know about the subclass/superclass relationships between classes, contain the description that instances are created from, \x0aand hold the method dictionary that's associated with each class.\x0a\x0aBehavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy."
  5238. smalltalk.addMethod(
  5239. "_addCompiledMethod_",
  5240. smalltalk.method({
  5241. selector: "addCompiledMethod:",
  5242. category: 'compiling',
  5243. fn: function (aMethod){
  5244. var self=this;
  5245. return smalltalk.withContext(function($ctx1) { var $1,$2;
  5246. _st(self)._basicAddCompiledMethod_(aMethod);
  5247. $1=_st((smalltalk.MethodAdded || MethodAdded))._new();
  5248. _st($1)._theClass_(self);
  5249. _st($1)._method_(aMethod);
  5250. $2=_st($1)._yourself();
  5251. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  5252. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  5253. args: ["aMethod"],
  5254. source: "addCompiledMethod: aMethod\x0a\x09self basicAddCompiledMethod: aMethod.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodAdded new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  5255. messageSends: ["basicAddCompiledMethod:", "announce:", "theClass:", "new", "method:", "yourself", "current"],
  5256. referencedClasses: ["MethodAdded", "SystemAnnouncer"]
  5257. }),
  5258. smalltalk.Behavior);
  5259. smalltalk.addMethod(
  5260. "_allInstanceVariableNames",
  5261. smalltalk.method({
  5262. selector: "allInstanceVariableNames",
  5263. category: 'accessing',
  5264. fn: function (){
  5265. var self=this;
  5266. var result;
  5267. return smalltalk.withContext(function($ctx1) { var $1,$2;
  5268. result=_st(_st(self)._instanceVariableNames())._copy();
  5269. $1=_st(self)._superclass();
  5270. if(($receiver = $1) == nil || $receiver == undefined){
  5271. $1;
  5272. } else {
  5273. _st(result)._addAll_(_st(_st(self)._superclass())._allInstanceVariableNames());
  5274. };
  5275. $2=result;
  5276. return $2;
  5277. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result}, smalltalk.Behavior)})},
  5278. args: [],
  5279. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09 result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  5280. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  5281. referencedClasses: []
  5282. }),
  5283. smalltalk.Behavior);
  5284. smalltalk.addMethod(
  5285. "_allSubclasses",
  5286. smalltalk.method({
  5287. selector: "allSubclasses",
  5288. category: 'accessing',
  5289. fn: function (){
  5290. var self=this;
  5291. var result;
  5292. return smalltalk.withContext(function($ctx1) { var $1;
  5293. result=_st(self)._subclasses();
  5294. _st(_st(self)._subclasses())._do_((function(each){
  5295. return smalltalk.withContext(function($ctx2) { return _st(result)._addAll_(_st(each)._allSubclasses());
  5296. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5297. $1=result;
  5298. return $1;
  5299. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{result:result}, smalltalk.Behavior)})},
  5300. args: [],
  5301. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09 result addAll: each allSubclasses].\x0a\x09^result",
  5302. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  5303. referencedClasses: []
  5304. }),
  5305. smalltalk.Behavior);
  5306. smalltalk.addMethod(
  5307. "_allSuperclasses",
  5308. smalltalk.method({
  5309. selector: "allSuperclasses",
  5310. category: 'accessing',
  5311. fn: function (){
  5312. var self=this;
  5313. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  5314. $1=_st(self)._superclass();
  5315. if(($receiver = $1) == nil || $receiver == undefined){
  5316. return [];
  5317. } else {
  5318. $1;
  5319. };
  5320. $3=_st((smalltalk.OrderedCollection || OrderedCollection))._with_(_st(self)._superclass());
  5321. _st($3)._addAll_(_st(_st(self)._superclass())._allSuperclasses());
  5322. $4=_st($3)._yourself();
  5323. $2=$4;
  5324. return $2;
  5325. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{}, smalltalk.Behavior)})},
  5326. args: [],
  5327. source: "allSuperclasses\x0a\x09\x0a self superclass ifNil: [ ^ #() ].\x0a \x0a\x09^ (OrderedCollection with: self superclass) \x0a \x09addAll: self superclass allSuperclasses;\x0a yourself",
  5328. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  5329. referencedClasses: ["OrderedCollection"]
  5330. }),
  5331. smalltalk.Behavior);
  5332. smalltalk.addMethod(
  5333. "_basicAddCompiledMethod_",
  5334. smalltalk.method({
  5335. selector: "basicAddCompiledMethod:",
  5336. category: 'private',
  5337. fn: function (aMethod){
  5338. var self=this;
  5339. return smalltalk.withContext(function($ctx1) { smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
  5340. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  5341. args: ["aMethod"],
  5342. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>",
  5343. messageSends: [],
  5344. referencedClasses: []
  5345. }),
  5346. smalltalk.Behavior);
  5347. smalltalk.addMethod(
  5348. "_basicNew",
  5349. smalltalk.method({
  5350. selector: "basicNew",
  5351. category: 'instance creation',
  5352. fn: function (){
  5353. var self=this;
  5354. return smalltalk.withContext(function($ctx1) { return new self.fn();
  5355. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{}, smalltalk.Behavior)})},
  5356. args: [],
  5357. source: "basicNew\x0a\x09<return new self.fn()>",
  5358. messageSends: [],
  5359. referencedClasses: []
  5360. }),
  5361. smalltalk.Behavior);
  5362. smalltalk.addMethod(
  5363. "_basicRemoveCompiledMethod_",
  5364. smalltalk.method({
  5365. selector: "basicRemoveCompiledMethod:",
  5366. category: 'private',
  5367. fn: function (aMethod){
  5368. var self=this;
  5369. return smalltalk.withContext(function($ctx1) {
  5370. smalltalk.removeMethod(aMethod)
  5371. smalltalk.init(self);
  5372. ;
  5373. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  5374. args: ["aMethod"],
  5375. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<\x0a \x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a >",
  5376. messageSends: [],
  5377. referencedClasses: []
  5378. }),
  5379. smalltalk.Behavior);
  5380. smalltalk.addMethod(
  5381. "_canUnderstand_",
  5382. smalltalk.method({
  5383. selector: "canUnderstand:",
  5384. category: 'testing',
  5385. fn: function (aSelector){
  5386. var self=this;
  5387. return smalltalk.withContext(function($ctx1) { var $1;
  5388. $1=_st(_st(_st(_st(self)._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
  5389. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._superclass())._notNil())._and_((function(){
  5390. return smalltalk.withContext(function($ctx3) { return _st(_st(self)._superclass())._canUnderstand_(aSelector);
  5391. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  5392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5393. return $1;
  5394. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector}, smalltalk.Behavior)})},
  5395. args: ["aSelector"],
  5396. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  5397. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  5398. referencedClasses: []
  5399. }),
  5400. smalltalk.Behavior);
  5401. smalltalk.addMethod(
  5402. "_comment",
  5403. smalltalk.method({
  5404. selector: "comment",
  5405. category: 'accessing',
  5406. fn: function (){
  5407. var self=this;
  5408. return smalltalk.withContext(function($ctx1) { var $2,$1;
  5409. $2=_st(self)._basicAt_("comment");
  5410. if(($receiver = $2) == nil || $receiver == undefined){
  5411. $1="";
  5412. } else {
  5413. $1=$2;
  5414. };
  5415. return $1;
  5416. }, function($ctx1) {$ctx1.fill(self,"comment",{}, smalltalk.Behavior)})},
  5417. args: [],
  5418. source: "comment\x0a ^(self basicAt: 'comment') ifNil: ['']",
  5419. messageSends: ["ifNil:", "basicAt:"],
  5420. referencedClasses: []
  5421. }),
  5422. smalltalk.Behavior);
  5423. smalltalk.addMethod(
  5424. "_comment_",
  5425. smalltalk.method({
  5426. selector: "comment:",
  5427. category: 'accessing',
  5428. fn: function (aString){
  5429. var self=this;
  5430. return smalltalk.withContext(function($ctx1) { var $1,$2;
  5431. _st(self)._basicAt_put_("comment",aString);
  5432. $1=_st((smalltalk.ClassCommentChanged || ClassCommentChanged))._new();
  5433. _st($1)._theClass_(self);
  5434. $2=_st($1)._yourself();
  5435. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  5436. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString}, smalltalk.Behavior)})},
  5437. args: ["aString"],
  5438. source: "comment: aString\x0a self basicAt: 'comment' put: aString.\x0a SystemAnnouncer current\x0a \x09announce: (ClassCommentChanged new\x0a \x09theClass: self;\x0a yourself)",
  5439. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  5440. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  5441. }),
  5442. smalltalk.Behavior);
  5443. smalltalk.addMethod(
  5444. "_commentStamp",
  5445. smalltalk.method({
  5446. selector: "commentStamp",
  5447. category: 'accessing',
  5448. fn: function (){
  5449. var self=this;
  5450. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  5451. $2=_st((smalltalk.ClassCommentReader || ClassCommentReader))._new();
  5452. _st($2)._class_(self);
  5453. $3=_st($2)._yourself();
  5454. $1=$3;
  5455. return $1;
  5456. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{}, smalltalk.Behavior)})},
  5457. args: [],
  5458. source: "commentStamp\x0a ^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  5459. messageSends: ["class:", "new", "yourself"],
  5460. referencedClasses: ["ClassCommentReader"]
  5461. }),
  5462. smalltalk.Behavior);
  5463. smalltalk.addMethod(
  5464. "_commentStamp_prior_",
  5465. smalltalk.method({
  5466. selector: "commentStamp:prior:",
  5467. category: 'accessing',
  5468. fn: function (aStamp,prior){
  5469. var self=this;
  5470. return smalltalk.withContext(function($ctx1) { var $1;
  5471. $1=_st(self)._commentStamp();
  5472. return $1;
  5473. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior}, smalltalk.Behavior)})},
  5474. args: ["aStamp", "prior"],
  5475. source: "commentStamp: aStamp prior: prior\x0a ^self commentStamp",
  5476. messageSends: ["commentStamp"],
  5477. referencedClasses: []
  5478. }),
  5479. smalltalk.Behavior);
  5480. smalltalk.addMethod(
  5481. "_compile_",
  5482. smalltalk.method({
  5483. selector: "compile:",
  5484. category: 'compiling',
  5485. fn: function (aString){
  5486. var self=this;
  5487. return smalltalk.withContext(function($ctx1) { _st(self)._compile_category_(aString,"");
  5488. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.Behavior)})},
  5489. args: ["aString"],
  5490. source: "compile: aString\x0a\x09self compile: aString category: ''",
  5491. messageSends: ["compile:category:"],
  5492. referencedClasses: []
  5493. }),
  5494. smalltalk.Behavior);
  5495. smalltalk.addMethod(
  5496. "_compile_category_",
  5497. smalltalk.method({
  5498. selector: "compile:category:",
  5499. category: 'compiling',
  5500. fn: function (aString,anotherString){
  5501. var self=this;
  5502. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(aString,self,anotherString);
  5503. return self}, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString}, smalltalk.Behavior)})},
  5504. args: ["aString", "anotherString"],
  5505. source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString \x0a forClass: self \x0a category: anotherString",
  5506. messageSends: ["install:forClass:category:", "new"],
  5507. referencedClasses: ["Compiler"]
  5508. }),
  5509. smalltalk.Behavior);
  5510. smalltalk.addMethod(
  5511. "_definition",
  5512. smalltalk.method({
  5513. selector: "definition",
  5514. category: 'accessing',
  5515. fn: function (){
  5516. var self=this;
  5517. return smalltalk.withContext(function($ctx1) { return "";
  5518. }, function($ctx1) {$ctx1.fill(self,"definition",{}, smalltalk.Behavior)})},
  5519. args: [],
  5520. source: "definition\x0a\x09^ ''",
  5521. messageSends: [],
  5522. referencedClasses: []
  5523. }),
  5524. smalltalk.Behavior);
  5525. smalltalk.addMethod(
  5526. "_includesSelector_",
  5527. smalltalk.method({
  5528. selector: "includesSelector:",
  5529. category: 'testing',
  5530. fn: function (aSymbol){
  5531. var self=this;
  5532. return smalltalk.withContext(function($ctx1) { var $1;
  5533. $1=_st(_st(self)._methodDictionary())._includesKey_(_st(aSymbol)._asString());
  5534. return $1;
  5535. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aSymbol:aSymbol}, smalltalk.Behavior)})},
  5536. args: ["aSymbol"],
  5537. source: "includesSelector: aSymbol\x0a\x09^ self methodDictionary includesKey: aSymbol asString",
  5538. messageSends: ["includesKey:", "asString", "methodDictionary"],
  5539. referencedClasses: []
  5540. }),
  5541. smalltalk.Behavior);
  5542. smalltalk.addMethod(
  5543. "_inheritsFrom_",
  5544. smalltalk.method({
  5545. selector: "inheritsFrom:",
  5546. category: 'testing',
  5547. fn: function (aClass){
  5548. var self=this;
  5549. return smalltalk.withContext(function($ctx1) { var $1;
  5550. $1=_st(_st(aClass)._allSubclasses())._includes_(self);
  5551. return $1;
  5552. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass}, smalltalk.Behavior)})},
  5553. args: ["aClass"],
  5554. source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
  5555. messageSends: ["includes:", "allSubclasses"],
  5556. referencedClasses: []
  5557. }),
  5558. smalltalk.Behavior);
  5559. smalltalk.addMethod(
  5560. "_instanceVariableNames",
  5561. smalltalk.method({
  5562. selector: "instanceVariableNames",
  5563. category: 'accessing',
  5564. fn: function (){
  5565. var self=this;
  5566. return smalltalk.withContext(function($ctx1) { return self.iVarNames;
  5567. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{}, smalltalk.Behavior)})},
  5568. args: [],
  5569. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5570. messageSends: [],
  5571. referencedClasses: []
  5572. }),
  5573. smalltalk.Behavior);
  5574. smalltalk.addMethod(
  5575. "_lookupSelector_",
  5576. smalltalk.method({
  5577. selector: "lookupSelector:",
  5578. category: 'accessing',
  5579. fn: function (selector){
  5580. var self=this;
  5581. var lookupClass;
  5582. return smalltalk.withContext(function($ctx1) { var $1,$2;
  5583. var $early={};
  5584. try {
  5585. lookupClass=self;
  5586. _st((function(){
  5587. return smalltalk.withContext(function($ctx2) { return _st(lookupClass).__eq(nil);
  5588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  5589. return smalltalk.withContext(function($ctx2) { $1=_st(lookupClass)._includesSelector_(selector);
  5590. if(smalltalk.assert($1)){
  5591. $2=_st(lookupClass)._methodAt_(selector);
  5592. throw $early=[$2];
  5593. };
  5594. lookupClass=_st(lookupClass)._superclass();
  5595. return lookupClass;
  5596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5597. return nil;
  5598. }
  5599. catch(e) {if(e===$early)return e[0]; throw e}
  5600. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass}, smalltalk.Behavior)})},
  5601. args: ["selector"],
  5602. 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 \x0a\x09| lookupClass |\x0a \x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a \x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  5603. messageSends: ["whileFalse:", "ifTrue:", "methodAt:", "includesSelector:", "superclass", "="],
  5604. referencedClasses: []
  5605. }),
  5606. smalltalk.Behavior);
  5607. smalltalk.addMethod(
  5608. "_methodAt_",
  5609. smalltalk.method({
  5610. selector: "methodAt:",
  5611. category: 'accessing',
  5612. fn: function (aSymbol){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) { var $1;
  5615. $1=_st(_st(self)._methodDictionary())._at_(_st(aSymbol)._asString());
  5616. return $1;
  5617. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aSymbol:aSymbol}, smalltalk.Behavior)})},
  5618. args: ["aSymbol"],
  5619. source: "methodAt: aSymbol\x0a\x09^ self methodDictionary at: aSymbol asString",
  5620. messageSends: ["at:", "asString", "methodDictionary"],
  5621. referencedClasses: []
  5622. }),
  5623. smalltalk.Behavior);
  5624. smalltalk.addMethod(
  5625. "_methodDictionary",
  5626. smalltalk.method({
  5627. selector: "methodDictionary",
  5628. category: 'accessing',
  5629. fn: function (){
  5630. var self=this;
  5631. return smalltalk.withContext(function($ctx1) { var dict = smalltalk.HashedCollection._new();
  5632. var methods = self.methods;
  5633. for(var i in methods) {
  5634. if(methods[i].selector) {
  5635. dict._at_put_(methods[i].selector, methods[i]);
  5636. }
  5637. };
  5638. return dict;
  5639. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{}, smalltalk.Behavior)})},
  5640. args: [],
  5641. 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>",
  5642. messageSends: [],
  5643. referencedClasses: []
  5644. }),
  5645. smalltalk.Behavior);
  5646. smalltalk.addMethod(
  5647. "_methods",
  5648. smalltalk.method({
  5649. selector: "methods",
  5650. category: 'accessing',
  5651. fn: function (){
  5652. var self=this;
  5653. return smalltalk.withContext(function($ctx1) { var $1;
  5654. $1=_st(_st(self)._methodDictionary())._values();
  5655. return $1;
  5656. }, function($ctx1) {$ctx1.fill(self,"methods",{}, smalltalk.Behavior)})},
  5657. args: [],
  5658. source: "methods\x0a\x09^ self methodDictionary values",
  5659. messageSends: ["values", "methodDictionary"],
  5660. referencedClasses: []
  5661. }),
  5662. smalltalk.Behavior);
  5663. smalltalk.addMethod(
  5664. "_methodsFor_",
  5665. smalltalk.method({
  5666. selector: "methodsFor:",
  5667. category: 'accessing',
  5668. fn: function (aString){
  5669. var self=this;
  5670. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  5671. $2=_st((smalltalk.ClassCategoryReader || ClassCategoryReader))._new();
  5672. _st($2)._class_category_(self,aString);
  5673. $3=_st($2)._yourself();
  5674. $1=$3;
  5675. return $1;
  5676. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString}, smalltalk.Behavior)})},
  5677. args: ["aString"],
  5678. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09 class: self category: aString;\x0a\x09 yourself",
  5679. messageSends: ["class:category:", "new", "yourself"],
  5680. referencedClasses: ["ClassCategoryReader"]
  5681. }),
  5682. smalltalk.Behavior);
  5683. smalltalk.addMethod(
  5684. "_methodsFor_stamp_",
  5685. smalltalk.method({
  5686. selector: "methodsFor:stamp:",
  5687. category: 'accessing',
  5688. fn: function (aString,aStamp){
  5689. var self=this;
  5690. return smalltalk.withContext(function($ctx1) { var $1;
  5691. $1=_st(self)._methodsFor_(aString);
  5692. return $1;
  5693. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp}, smalltalk.Behavior)})},
  5694. args: ["aString", "aStamp"],
  5695. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  5696. messageSends: ["methodsFor:"],
  5697. referencedClasses: []
  5698. }),
  5699. smalltalk.Behavior);
  5700. smalltalk.addMethod(
  5701. "_methodsInProtocol_",
  5702. smalltalk.method({
  5703. selector: "methodsInProtocol:",
  5704. category: 'accessing',
  5705. fn: function (aString){
  5706. var self=this;
  5707. return smalltalk.withContext(function($ctx1) { var $1;
  5708. $1=_st(_st(_st(self)._methodDictionary())._values())._select_((function(each){
  5709. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._protocol()).__eq(aString);
  5710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5711. return $1;
  5712. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString}, smalltalk.Behavior)})},
  5713. args: ["aString"],
  5714. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  5715. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  5716. referencedClasses: []
  5717. }),
  5718. smalltalk.Behavior);
  5719. smalltalk.addMethod(
  5720. "_name",
  5721. smalltalk.method({
  5722. selector: "name",
  5723. category: 'accessing',
  5724. fn: function (){
  5725. var self=this;
  5726. return smalltalk.withContext(function($ctx1) { return self.className || nil;
  5727. return self}, function($ctx1) {$ctx1.fill(self,"name",{}, smalltalk.Behavior)})},
  5728. args: [],
  5729. source: "name\x0a\x09<return self.className || nil>",
  5730. messageSends: [],
  5731. referencedClasses: []
  5732. }),
  5733. smalltalk.Behavior);
  5734. smalltalk.addMethod(
  5735. "_new",
  5736. smalltalk.method({
  5737. selector: "new",
  5738. category: 'instance creation',
  5739. fn: function (){
  5740. var self=this;
  5741. return smalltalk.withContext(function($ctx1) { var $1;
  5742. $1=_st(_st(self)._basicNew())._initialize();
  5743. return $1;
  5744. }, function($ctx1) {$ctx1.fill(self,"new",{}, smalltalk.Behavior)})},
  5745. args: [],
  5746. source: "new\x0a\x09^self basicNew initialize",
  5747. messageSends: ["initialize", "basicNew"],
  5748. referencedClasses: []
  5749. }),
  5750. smalltalk.Behavior);
  5751. smalltalk.addMethod(
  5752. "_organization",
  5753. smalltalk.method({
  5754. selector: "organization",
  5755. category: 'accessing',
  5756. fn: function (){
  5757. var self=this;
  5758. return smalltalk.withContext(function($ctx1) { var $1;
  5759. $1=_st(self)._basicAt_("organization");
  5760. return $1;
  5761. }, function($ctx1) {$ctx1.fill(self,"organization",{}, smalltalk.Behavior)})},
  5762. args: [],
  5763. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5764. messageSends: ["basicAt:"],
  5765. referencedClasses: []
  5766. }),
  5767. smalltalk.Behavior);
  5768. smalltalk.addMethod(
  5769. "_protocols",
  5770. smalltalk.method({
  5771. selector: "protocols",
  5772. category: 'accessing',
  5773. fn: function (){
  5774. var self=this;
  5775. return smalltalk.withContext(function($ctx1) { var $1;
  5776. $1=_st(_st(_st(self)._organization())._elements())._sorted();
  5777. return $1;
  5778. }, function($ctx1) {$ctx1.fill(self,"protocols",{}, smalltalk.Behavior)})},
  5779. args: [],
  5780. source: "protocols\x0a ^ self organization elements sorted",
  5781. messageSends: ["sorted", "elements", "organization"],
  5782. referencedClasses: []
  5783. }),
  5784. smalltalk.Behavior);
  5785. smalltalk.addMethod(
  5786. "_protocolsDo_",
  5787. smalltalk.method({
  5788. selector: "protocolsDo:",
  5789. category: 'accessing',
  5790. fn: function (aBlock){
  5791. var self=this;
  5792. var methodsByCategory;
  5793. return smalltalk.withContext(function($ctx1) { methodsByCategory=_st((smalltalk.HashedCollection || HashedCollection))._new();
  5794. _st(_st(_st(self)._methodDictionary())._values())._do_((function(m){
  5795. return smalltalk.withContext(function($ctx2) { return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
  5796. return smalltalk.withContext(function($ctx3) { return _st((smalltalk.Array || Array))._new();
  5797. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._add_(m);
  5798. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1)})}));
  5799. _st(_st(self)._protocols())._do_((function(category){
  5800. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
  5801. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  5802. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory}, smalltalk.Behavior)})},
  5803. args: ["aBlock"],
  5804. 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)]",
  5805. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  5806. referencedClasses: ["HashedCollection", "Array"]
  5807. }),
  5808. smalltalk.Behavior);
  5809. smalltalk.addMethod(
  5810. "_prototype",
  5811. smalltalk.method({
  5812. selector: "prototype",
  5813. category: 'accessing',
  5814. fn: function (){
  5815. var self=this;
  5816. return smalltalk.withContext(function($ctx1) { return self.fn.prototype;
  5817. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{}, smalltalk.Behavior)})},
  5818. args: [],
  5819. source: "prototype\x0a\x09<return self.fn.prototype>",
  5820. messageSends: [],
  5821. referencedClasses: []
  5822. }),
  5823. smalltalk.Behavior);
  5824. smalltalk.addMethod(
  5825. "_removeCompiledMethod_",
  5826. smalltalk.method({
  5827. selector: "removeCompiledMethod:",
  5828. category: 'compiling',
  5829. fn: function (aMethod){
  5830. var self=this;
  5831. return smalltalk.withContext(function($ctx1) { var $1,$2;
  5832. _st(self)._basicRemoveCompiledMethod_(aMethod);
  5833. $1=_st((smalltalk.MethodRemoved || MethodRemoved))._new();
  5834. _st($1)._theClass_(self);
  5835. _st($1)._method_(aMethod);
  5836. $2=_st($1)._yourself();
  5837. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  5838. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  5839. args: ["aMethod"],
  5840. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodRemoved new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  5841. messageSends: ["basicRemoveCompiledMethod:", "announce:", "theClass:", "new", "method:", "yourself", "current"],
  5842. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  5843. }),
  5844. smalltalk.Behavior);
  5845. smalltalk.addMethod(
  5846. "_selectors",
  5847. smalltalk.method({
  5848. selector: "selectors",
  5849. category: 'accessing',
  5850. fn: function (){
  5851. var self=this;
  5852. return smalltalk.withContext(function($ctx1) { var $1;
  5853. $1=_st(_st(self)._methodDictionary())._keys();
  5854. return $1;
  5855. }, function($ctx1) {$ctx1.fill(self,"selectors",{}, smalltalk.Behavior)})},
  5856. args: [],
  5857. source: "selectors\x0a\x09^ self methodDictionary keys",
  5858. messageSends: ["keys", "methodDictionary"],
  5859. referencedClasses: []
  5860. }),
  5861. smalltalk.Behavior);
  5862. smalltalk.addMethod(
  5863. "_subclasses",
  5864. smalltalk.method({
  5865. selector: "subclasses",
  5866. category: 'accessing',
  5867. fn: function (){
  5868. var self=this;
  5869. return smalltalk.withContext(function($ctx1) { return smalltalk.subclasses(self);
  5870. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{}, smalltalk.Behavior)})},
  5871. args: [],
  5872. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  5873. messageSends: [],
  5874. referencedClasses: []
  5875. }),
  5876. smalltalk.Behavior);
  5877. smalltalk.addMethod(
  5878. "_superclass",
  5879. smalltalk.method({
  5880. selector: "superclass",
  5881. category: 'accessing',
  5882. fn: function (){
  5883. var self=this;
  5884. return smalltalk.withContext(function($ctx1) { return self.superclass || nil;
  5885. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{}, smalltalk.Behavior)})},
  5886. args: [],
  5887. source: "superclass\x0a\x09<return self.superclass || nil>",
  5888. messageSends: [],
  5889. referencedClasses: []
  5890. }),
  5891. smalltalk.Behavior);
  5892. smalltalk.addMethod(
  5893. "_theMetaClass",
  5894. smalltalk.method({
  5895. selector: "theMetaClass",
  5896. category: 'accessing',
  5897. fn: function (){
  5898. var self=this;
  5899. return smalltalk.withContext(function($ctx1) { var $1;
  5900. $1=_st(self)._class();
  5901. return $1;
  5902. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{}, smalltalk.Behavior)})},
  5903. args: [],
  5904. source: "theMetaClass\x0a\x09^ self class",
  5905. messageSends: ["class"],
  5906. referencedClasses: []
  5907. }),
  5908. smalltalk.Behavior);
  5909. smalltalk.addMethod(
  5910. "_theNonMetaClass",
  5911. smalltalk.method({
  5912. selector: "theNonMetaClass",
  5913. category: 'accessing',
  5914. fn: function (){
  5915. var self=this;
  5916. return smalltalk.withContext(function($ctx1) { var $1;
  5917. $1=self;
  5918. return $1;
  5919. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{}, smalltalk.Behavior)})},
  5920. args: [],
  5921. source: "theNonMetaClass\x0a\x09^ self",
  5922. messageSends: [],
  5923. referencedClasses: []
  5924. }),
  5925. smalltalk.Behavior);
  5926. smalltalk.addMethod(
  5927. "_withAllSubclasses",
  5928. smalltalk.method({
  5929. selector: "withAllSubclasses",
  5930. category: 'accessing',
  5931. fn: function (){
  5932. var self=this;
  5933. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  5934. $2=_st((smalltalk.Array || Array))._with_(self);
  5935. _st($2)._addAll_(_st(self)._allSubclasses());
  5936. $3=_st($2)._yourself();
  5937. $1=$3;
  5938. return $1;
  5939. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{}, smalltalk.Behavior)})},
  5940. args: [],
  5941. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  5942. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  5943. referencedClasses: ["Array"]
  5944. }),
  5945. smalltalk.Behavior);
  5946. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  5947. smalltalk.Class.comment="Class is __the__ class object. \x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
  5948. smalltalk.addMethod(
  5949. "_asJavascript",
  5950. smalltalk.method({
  5951. selector: "asJavascript",
  5952. category: 'converting',
  5953. fn: function (){
  5954. var self=this;
  5955. return smalltalk.withContext(function($ctx1) { var $1;
  5956. $1=_st("smalltalk.").__comma(_st(self)._name());
  5957. return $1;
  5958. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Class)})},
  5959. args: [],
  5960. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  5961. messageSends: [",", "name"],
  5962. referencedClasses: []
  5963. }),
  5964. smalltalk.Class);
  5965. smalltalk.addMethod(
  5966. "_category",
  5967. smalltalk.method({
  5968. selector: "category",
  5969. category: 'accessing',
  5970. fn: function (){
  5971. var self=this;
  5972. return smalltalk.withContext(function($ctx1) { var $2,$1;
  5973. $2=_st(self)._package();
  5974. if(($receiver = $2) == nil || $receiver == undefined){
  5975. $1="Unclassified";
  5976. } else {
  5977. $1=_st(_st(self)._package())._name();
  5978. };
  5979. return $1;
  5980. }, function($ctx1) {$ctx1.fill(self,"category",{}, smalltalk.Class)})},
  5981. args: [],
  5982. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  5983. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  5984. referencedClasses: []
  5985. }),
  5986. smalltalk.Class);
  5987. smalltalk.addMethod(
  5988. "_definition",
  5989. smalltalk.method({
  5990. selector: "definition",
  5991. category: 'accessing',
  5992. fn: function (){
  5993. var self=this;
  5994. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$5,$1;
  5995. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  5996. return smalltalk.withContext(function($ctx2) { $2=stream;
  5997. _st($2)._nextPutAll_(_st(_st(self)._superclass())._asString());
  5998. _st($2)._nextPutAll_(" subclass: #");
  5999. _st($2)._nextPutAll_(_st(self)._name());
  6000. _st($2)._nextPutAll_(_st(_st((smalltalk.String || String))._lf()).__comma(_st((smalltalk.String || String))._tab()));
  6001. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  6002. $3;
  6003. _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
  6004. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(each);
  6005. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  6006. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(" ");
  6007. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  6008. $4=stream;
  6009. _st($4)._nextPutAll_(_st(_st("'").__comma(_st((smalltalk.String || String))._lf())).__comma(_st((smalltalk.String || String))._tab()));
  6010. _st($4)._nextPutAll_("package: '");
  6011. _st($4)._nextPutAll_(_st(self)._category());
  6012. $5=_st($4)._nextPutAll_("'");
  6013. return $5;
  6014. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  6015. return $1;
  6016. }, function($ctx1) {$ctx1.fill(self,"definition",{}, smalltalk.Class)})},
  6017. args: [],
  6018. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09nextPutAll: self superclass asString;\x0a\x09 \x09nextPutAll: ' subclass: #';\x0a\x09 \x09nextPutAll: self name;\x0a\x09 \x09nextPutAll: String lf, String tab;\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames \x0a \x09do: [ :each | stream nextPutAll: each ] \x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09 \x09nextPutAll: '''', String lf, String tab;\x0a\x09 \x09nextPutAll: 'package: ''';\x0a\x09 \x09nextPutAll: self category;\x0a\x09 \x09nextPutAll: '''' ]",
  6019. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  6020. referencedClasses: ["String"]
  6021. }),
  6022. smalltalk.Class);
  6023. smalltalk.addMethod(
  6024. "_isClass",
  6025. smalltalk.method({
  6026. selector: "isClass",
  6027. category: 'testing',
  6028. fn: function (){
  6029. var self=this;
  6030. return smalltalk.withContext(function($ctx1) { return true;
  6031. }, function($ctx1) {$ctx1.fill(self,"isClass",{}, smalltalk.Class)})},
  6032. args: [],
  6033. source: "isClass\x0a\x09^true",
  6034. messageSends: [],
  6035. referencedClasses: []
  6036. }),
  6037. smalltalk.Class);
  6038. smalltalk.addMethod(
  6039. "_package",
  6040. smalltalk.method({
  6041. selector: "package",
  6042. category: 'accessing',
  6043. fn: function (){
  6044. var self=this;
  6045. return smalltalk.withContext(function($ctx1) { return self.pkg;
  6046. return self}, function($ctx1) {$ctx1.fill(self,"package",{}, smalltalk.Class)})},
  6047. args: [],
  6048. source: "package\x0a\x09<return self.pkg>",
  6049. messageSends: [],
  6050. referencedClasses: []
  6051. }),
  6052. smalltalk.Class);
  6053. smalltalk.addMethod(
  6054. "_package_",
  6055. smalltalk.method({
  6056. selector: "package:",
  6057. category: 'accessing',
  6058. fn: function (aPackage){
  6059. var self=this;
  6060. return smalltalk.withContext(function($ctx1) { self.pkg = aPackage;
  6061. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage}, smalltalk.Class)})},
  6062. args: ["aPackage"],
  6063. source: "package: aPackage\x0a\x09<self.pkg = aPackage>",
  6064. messageSends: [],
  6065. referencedClasses: []
  6066. }),
  6067. smalltalk.Class);
  6068. smalltalk.addMethod(
  6069. "_printString",
  6070. smalltalk.method({
  6071. selector: "printString",
  6072. category: 'printing',
  6073. fn: function (){
  6074. var self=this;
  6075. return smalltalk.withContext(function($ctx1) { var $1;
  6076. $1=_st(self)._name();
  6077. return $1;
  6078. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Class)})},
  6079. args: [],
  6080. source: "printString\x0a\x09^self name",
  6081. messageSends: ["name"],
  6082. referencedClasses: []
  6083. }),
  6084. smalltalk.Class);
  6085. smalltalk.addMethod(
  6086. "_rename_",
  6087. smalltalk.method({
  6088. selector: "rename:",
  6089. category: 'accessing',
  6090. fn: function (aString){
  6091. var self=this;
  6092. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._renameClass_to_(self,aString);
  6093. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString}, smalltalk.Class)})},
  6094. args: ["aString"],
  6095. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6096. messageSends: ["renameClass:to:", "new"],
  6097. referencedClasses: ["ClassBuilder"]
  6098. }),
  6099. smalltalk.Class);
  6100. smalltalk.addMethod(
  6101. "_subclass_instanceVariableNames_",
  6102. smalltalk.method({
  6103. selector: "subclass:instanceVariableNames:",
  6104. category: 'class creation',
  6105. fn: function (aString,anotherString){
  6106. var self=this;
  6107. return smalltalk.withContext(function($ctx1) { var $1;
  6108. $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6109. return $1;
  6110. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString}, smalltalk.Class)})},
  6111. args: ["aString", "anotherString"],
  6112. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  6113. messageSends: ["subclass:instanceVariableNames:package:"],
  6114. referencedClasses: []
  6115. }),
  6116. smalltalk.Class);
  6117. smalltalk.addMethod(
  6118. "_subclass_instanceVariableNames_category_",
  6119. smalltalk.method({
  6120. selector: "subclass:instanceVariableNames:category:",
  6121. category: 'class creation',
  6122. fn: function (aString,aString2,aString3){
  6123. var self=this;
  6124. return smalltalk.withContext(function($ctx1) { var $1;
  6125. _st(self)._deprecatedAPI();
  6126. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6127. return $1;
  6128. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3}, smalltalk.Class)})},
  6129. args: ["aString", "aString2", "aString3"],
  6130. 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",
  6131. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  6132. referencedClasses: []
  6133. }),
  6134. smalltalk.Class);
  6135. smalltalk.addMethod(
  6136. "_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_",
  6137. smalltalk.method({
  6138. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6139. category: 'class creation',
  6140. fn: function (aString,aString2,classVars,pools,aString3){
  6141. var self=this;
  6142. return smalltalk.withContext(function($ctx1) { var $1;
  6143. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6144. return $1;
  6145. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3}, smalltalk.Class)})},
  6146. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6147. 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",
  6148. messageSends: ["subclass:instanceVariableNames:package:"],
  6149. referencedClasses: []
  6150. }),
  6151. smalltalk.Class);
  6152. smalltalk.addMethod(
  6153. "_subclass_instanceVariableNames_package_",
  6154. smalltalk.method({
  6155. selector: "subclass:instanceVariableNames:package:",
  6156. category: 'class creation',
  6157. fn: function (aString,aString2,aString3){
  6158. var self=this;
  6159. return smalltalk.withContext(function($ctx1) { var $1;
  6160. $1=_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6161. return $1;
  6162. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3}, smalltalk.Class)})},
  6163. args: ["aString", "aString2", "aString3"],
  6164. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6165. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  6166. referencedClasses: ["ClassBuilder"]
  6167. }),
  6168. smalltalk.Class);
  6169. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  6170. smalltalk.Metaclass.comment="Metaclass is the root of the class hierarchy.\x0a\x0aMetaclass instances are metaclasses, one for each real class. \x0aMetaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of."
  6171. smalltalk.addMethod(
  6172. "_asJavascript",
  6173. smalltalk.method({
  6174. selector: "asJavascript",
  6175. category: 'converting',
  6176. fn: function (){
  6177. var self=this;
  6178. return smalltalk.withContext(function($ctx1) { var $1;
  6179. $1=_st(_st("smalltalk.").__comma(_st(_st(self)._instanceClass())._name())).__comma(".klass");
  6180. return $1;
  6181. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Metaclass)})},
  6182. args: [],
  6183. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  6184. messageSends: [",", "name", "instanceClass"],
  6185. referencedClasses: []
  6186. }),
  6187. smalltalk.Metaclass);
  6188. smalltalk.addMethod(
  6189. "_definition",
  6190. smalltalk.method({
  6191. selector: "definition",
  6192. category: 'accessing',
  6193. fn: function (){
  6194. var self=this;
  6195. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  6196. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  6197. return smalltalk.withContext(function($ctx2) { $2=stream;
  6198. _st($2)._nextPutAll_(_st(self)._asString());
  6199. _st($2)._nextPutAll_(" class ");
  6200. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  6201. $3;
  6202. _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
  6203. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(each);
  6204. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  6205. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(" ");
  6206. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  6207. return _st(stream)._nextPutAll_("'");
  6208. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  6209. return $1;
  6210. }, function($ctx1) {$ctx1.fill(self,"definition",{}, smalltalk.Metaclass)})},
  6211. args: [],
  6212. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09 \x09nextPutAll: self asString;\x0a\x09 \x09nextPutAll: ' class ';\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09 \x09do: [ :each | stream nextPutAll: each ]\x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  6213. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  6214. referencedClasses: ["String"]
  6215. }),
  6216. smalltalk.Metaclass);
  6217. smalltalk.addMethod(
  6218. "_instanceClass",
  6219. smalltalk.method({
  6220. selector: "instanceClass",
  6221. category: 'accessing',
  6222. fn: function (){
  6223. var self=this;
  6224. return smalltalk.withContext(function($ctx1) { return self.instanceClass;
  6225. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{}, smalltalk.Metaclass)})},
  6226. args: [],
  6227. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6228. messageSends: [],
  6229. referencedClasses: []
  6230. }),
  6231. smalltalk.Metaclass);
  6232. smalltalk.addMethod(
  6233. "_instanceVariableNames_",
  6234. smalltalk.method({
  6235. selector: "instanceVariableNames:",
  6236. category: 'accessing',
  6237. fn: function (aCollection){
  6238. var self=this;
  6239. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._class_instanceVariableNames_(self,aCollection);
  6240. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection}, smalltalk.Metaclass)})},
  6241. args: ["aCollection"],
  6242. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09 class: self instanceVariableNames: aCollection",
  6243. messageSends: ["class:instanceVariableNames:", "new"],
  6244. referencedClasses: ["ClassBuilder"]
  6245. }),
  6246. smalltalk.Metaclass);
  6247. smalltalk.addMethod(
  6248. "_isMetaclass",
  6249. smalltalk.method({
  6250. selector: "isMetaclass",
  6251. category: 'testing',
  6252. fn: function (){
  6253. var self=this;
  6254. return smalltalk.withContext(function($ctx1) { return true;
  6255. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{}, smalltalk.Metaclass)})},
  6256. args: [],
  6257. source: "isMetaclass\x0a\x09^true",
  6258. messageSends: [],
  6259. referencedClasses: []
  6260. }),
  6261. smalltalk.Metaclass);
  6262. smalltalk.addMethod(
  6263. "_printString",
  6264. smalltalk.method({
  6265. selector: "printString",
  6266. category: 'printing',
  6267. fn: function (){
  6268. var self=this;
  6269. return smalltalk.withContext(function($ctx1) { var $1;
  6270. $1=_st(_st(_st(self)._instanceClass())._name()).__comma(" class");
  6271. return $1;
  6272. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Metaclass)})},
  6273. args: [],
  6274. source: "printString\x0a\x09^self instanceClass name, ' class'",
  6275. messageSends: [",", "name", "instanceClass"],
  6276. referencedClasses: []
  6277. }),
  6278. smalltalk.Metaclass);
  6279. smalltalk.addMethod(
  6280. "_theMetaClass",
  6281. smalltalk.method({
  6282. selector: "theMetaClass",
  6283. category: 'accessing',
  6284. fn: function (){
  6285. var self=this;
  6286. return smalltalk.withContext(function($ctx1) { var $1;
  6287. $1=self;
  6288. return $1;
  6289. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{}, smalltalk.Metaclass)})},
  6290. args: [],
  6291. source: "theMetaClass\x0a\x09^ self",
  6292. messageSends: [],
  6293. referencedClasses: []
  6294. }),
  6295. smalltalk.Metaclass);
  6296. smalltalk.addMethod(
  6297. "_theNonMetaClass",
  6298. smalltalk.method({
  6299. selector: "theNonMetaClass",
  6300. category: 'accessing',
  6301. fn: function (){
  6302. var self=this;
  6303. return smalltalk.withContext(function($ctx1) { var $1;
  6304. $1=_st(self)._instanceClass();
  6305. return $1;
  6306. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{}, smalltalk.Metaclass)})},
  6307. args: [],
  6308. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6309. messageSends: ["instanceClass"],
  6310. referencedClasses: []
  6311. }),
  6312. smalltalk.Metaclass);
  6313. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  6314. smalltalk.ClassBuilder.comment="ClassBuilder is responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using ClassBuilder directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`."
  6315. smalltalk.addMethod(
  6316. "_addSubclassOf_named_instanceVariableNames_package_",
  6317. smalltalk.method({
  6318. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6319. category: 'private',
  6320. fn: function (aClass,aString,aCollection,packageName){
  6321. var self=this;
  6322. var theClass;
  6323. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  6324. theClass=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(aString);
  6325. $1=theClass;
  6326. if(($receiver = $1) == nil || $receiver == undefined){
  6327. $1;
  6328. } else {
  6329. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  6330. if(! smalltalk.assert($2)){
  6331. $3=_st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(aString,aClass,aCollection,packageName);
  6332. return $3;
  6333. };
  6334. };
  6335. $4=_st(self)._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,aString,aCollection,packageName);
  6336. return $4;
  6337. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName,theClass:theClass}, smalltalk.ClassBuilder)})},
  6338. args: ["aClass", "aString", "aCollection", "packageName"],
  6339. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a | theClass |\x0a \x0a theClass := Smalltalk current at: aString.\x0a \x0a \x09theClass ifNotNil: [ \x0a \x09theClass superclass == aClass ifFalse: [\x0a \x09\x09^ self \x0a \x09\x09migrateClassNamed: aString \x0a \x09 \x09superclass: aClass \x0a \x09 \x09instanceVariableNames: aCollection \x0a \x09package: packageName ] ].\x0a\x0a\x09^ self \x0a \x09basicAddSubclassOf: aClass \x0a named: aString \x0a instanceVariableNames: aCollection \x0a package: packageName",
  6340. messageSends: ["at:", "current", "ifNotNil:", "ifFalse:", "migrateClassNamed:superclass:instanceVariableNames:package:", "==", "superclass", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  6341. referencedClasses: ["Smalltalk"]
  6342. }),
  6343. smalltalk.ClassBuilder);
  6344. smalltalk.addMethod(
  6345. "_basicAddSubclassOf_named_instanceVariableNames_package_",
  6346. smalltalk.method({
  6347. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  6348. category: 'private',
  6349. fn: function (aClass,aString,aCollection,packageName){
  6350. var self=this;
  6351. return smalltalk.withContext(function($ctx1) {
  6352. smalltalk.addClass(aString, aClass, aCollection, packageName);
  6353. return smalltalk[aString]
  6354. ;
  6355. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName}, smalltalk.ClassBuilder)})},
  6356. args: ["aClass", "aString", "aCollection", "packageName"],
  6357. 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>",
  6358. messageSends: [],
  6359. referencedClasses: []
  6360. }),
  6361. smalltalk.ClassBuilder);
  6362. smalltalk.addMethod(
  6363. "_basicClass_instanceVariableNames_",
  6364. smalltalk.method({
  6365. selector: "basicClass:instanceVariableNames:",
  6366. category: 'private',
  6367. fn: function (aClass,aString){
  6368. var self=this;
  6369. return smalltalk.withContext(function($ctx1) { _st(self)._basicClass_instanceVariables_(aClass,_st(self)._instanceVariableNamesFor_(aString));
  6370. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  6371. args: ["aClass", "aString"],
  6372. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  6373. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  6374. referencedClasses: []
  6375. }),
  6376. smalltalk.ClassBuilder);
  6377. smalltalk.addMethod(
  6378. "_basicClass_instanceVariables_",
  6379. smalltalk.method({
  6380. selector: "basicClass:instanceVariables:",
  6381. category: 'private',
  6382. fn: function (aClass,aCollection){
  6383. var self=this;
  6384. return smalltalk.withContext(function($ctx1) { var $1;
  6385. $1=_st(aClass)._isMetaclass();
  6386. if(! smalltalk.assert($1)){
  6387. _st(self)._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  6388. };
  6389. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  6390. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection}, smalltalk.ClassBuilder)})},
  6391. args: ["aClass", "aCollection"],
  6392. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  6393. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:"],
  6394. referencedClasses: []
  6395. }),
  6396. smalltalk.ClassBuilder);
  6397. smalltalk.addMethod(
  6398. "_basicRemoveClass_",
  6399. smalltalk.method({
  6400. selector: "basicRemoveClass:",
  6401. category: 'private',
  6402. fn: function (aClass){
  6403. var self=this;
  6404. return smalltalk.withContext(function($ctx1) { smalltalk.removeClass(aClass);
  6405. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass}, smalltalk.ClassBuilder)})},
  6406. args: ["aClass"],
  6407. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  6408. messageSends: [],
  6409. referencedClasses: []
  6410. }),
  6411. smalltalk.ClassBuilder);
  6412. smalltalk.addMethod(
  6413. "_basicRenameClass_to_",
  6414. smalltalk.method({
  6415. selector: "basicRenameClass:to:",
  6416. category: 'private',
  6417. fn: function (aClass,aString){
  6418. var self=this;
  6419. return smalltalk.withContext(function($ctx1) {
  6420. smalltalk[aString] = aClass;
  6421. delete smalltalk[aClass.className];
  6422. aClass.className = aString;
  6423. ;
  6424. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  6425. args: ["aClass", "aString"],
  6426. 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>",
  6427. messageSends: [],
  6428. referencedClasses: []
  6429. }),
  6430. smalltalk.ClassBuilder);
  6431. smalltalk.addMethod(
  6432. "_class_instanceVariableNames_",
  6433. smalltalk.method({
  6434. selector: "class:instanceVariableNames:",
  6435. category: 'api',
  6436. fn: function (aClass,aString){
  6437. var self=this;
  6438. return smalltalk.withContext(function($ctx1) { var $1,$2;
  6439. _st(self)._basicClass_instanceVariableNames_(aClass,aString);
  6440. _st(self)._setupClass_(aClass);
  6441. $1=_st((smalltalk.ClassDefinitionChanged || ClassDefinitionChanged))._new();
  6442. _st($1)._theClass_(aClass);
  6443. $2=_st($1)._yourself();
  6444. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  6445. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  6446. args: ["aClass", "aString"],
  6447. source: "class: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariableNames: aString.\x0a self setupClass: aClass.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassDefinitionChanged new\x0a \x09theClass: aClass;\x0a yourself)",
  6448. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  6449. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  6450. }),
  6451. smalltalk.ClassBuilder);
  6452. smalltalk.addMethod(
  6453. "_copyClass_named_",
  6454. smalltalk.method({
  6455. selector: "copyClass:named:",
  6456. category: 'private',
  6457. fn: function (aClass,aString){
  6458. var self=this;
  6459. var newClass;
  6460. return smalltalk.withContext(function($ctx1) { var $1;
  6461. newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),aString,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  6462. _st(self)._copyClass_to_(aClass,newClass);
  6463. $1=newClass;
  6464. return $1;
  6465. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,aString:aString,newClass:newClass}, smalltalk.ClassBuilder)})},
  6466. args: ["aClass", "aString"],
  6467. source: "copyClass: aClass named: aString\x0a\x09| newClass |\x0a\x0a\x09newClass := self \x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: aString \x0a\x09\x09instanceVariableNames: aClass instanceVariableNames \x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a \x0a\x09^newClass",
  6468. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:"],
  6469. referencedClasses: []
  6470. }),
  6471. smalltalk.ClassBuilder);
  6472. smalltalk.addMethod(
  6473. "_copyClass_to_",
  6474. smalltalk.method({
  6475. selector: "copyClass:to:",
  6476. category: 'private',
  6477. fn: function (aClass,anotherClass){
  6478. var self=this;
  6479. return smalltalk.withContext(function($ctx1) { _st(anotherClass)._comment_(_st(aClass)._comment());
  6480. _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
  6481. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category());
  6482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6483. _st(self)._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames());
  6484. _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
  6485. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category());
  6486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6487. _st(self)._setupClass_(anotherClass);
  6488. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass}, smalltalk.ClassBuilder)})},
  6489. args: ["aClass", "anotherClass"],
  6490. 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",
  6491. messageSends: ["comment:", "comment", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  6492. referencedClasses: ["Compiler"]
  6493. }),
  6494. smalltalk.ClassBuilder);
  6495. smalltalk.addMethod(
  6496. "_installMethod_forClass_category_",
  6497. smalltalk.method({
  6498. selector: "installMethod:forClass:category:",
  6499. category: 'api',
  6500. fn: function (aCompiledMethod,aBehavior,aString){
  6501. var self=this;
  6502. return smalltalk.withContext(function($ctx1) { var $1;
  6503. _st(aCompiledMethod)._category_(aString);
  6504. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  6505. _st(self)._setupClass_(aBehavior);
  6506. $1=aCompiledMethod;
  6507. return $1;
  6508. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString}, smalltalk.ClassBuilder)})},
  6509. args: ["aCompiledMethod", "aBehavior", "aString"],
  6510. source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
  6511. messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
  6512. referencedClasses: []
  6513. }),
  6514. smalltalk.ClassBuilder);
  6515. smalltalk.addMethod(
  6516. "_instanceVariableNamesFor_",
  6517. smalltalk.method({
  6518. selector: "instanceVariableNamesFor:",
  6519. category: 'private',
  6520. fn: function (aString){
  6521. var self=this;
  6522. return smalltalk.withContext(function($ctx1) { var $1;
  6523. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  6524. return smalltalk.withContext(function($ctx2) { return _st(each)._isEmpty();
  6525. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6526. return $1;
  6527. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString}, smalltalk.ClassBuilder)})},
  6528. args: ["aString"],
  6529. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  6530. messageSends: ["reject:", "isEmpty", "tokenize:"],
  6531. referencedClasses: []
  6532. }),
  6533. smalltalk.ClassBuilder);
  6534. smalltalk.addMethod(
  6535. "_migrateClass_superclass_",
  6536. smalltalk.method({
  6537. selector: "migrateClass:superclass:",
  6538. category: 'private',
  6539. fn: function (aClass,anotherClass){
  6540. var self=this;
  6541. return smalltalk.withContext(function($ctx1) { _st(console)._log_(_st(aClass)._name());
  6542. _st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  6543. return self}, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass}, smalltalk.ClassBuilder)})},
  6544. args: ["aClass", "anotherClass"],
  6545. source: "migrateClass: aClass superclass: anotherClass\x0a\x09console log: aClass name.\x0a\x09self \x0a \x09migrateClassNamed: aClass name\x0a superclass: anotherClass\x0a instanceVariableNames: aClass instanceVariableNames\x0a package: aClass package name",
  6546. messageSends: ["log:", "name", "migrateClassNamed:superclass:instanceVariableNames:package:", "instanceVariableNames", "package"],
  6547. referencedClasses: []
  6548. }),
  6549. smalltalk.ClassBuilder);
  6550. smalltalk.addMethod(
  6551. "_migrateClassNamed_superclass_instanceVariableNames_package_",
  6552. smalltalk.method({
  6553. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  6554. category: 'private',
  6555. fn: function (aString,aClass,aCollection,packageName){
  6556. var self=this;
  6557. var oldClass,newClass;
  6558. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  6559. oldClass=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(aString);
  6560. _st(self)._basicRenameClass_to_(oldClass,_st("Old").__comma(aString));
  6561. newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(aClass,aString,aCollection,packageName);
  6562. _st(_st(oldClass)._subclasses())._do_((function(each){
  6563. return smalltalk.withContext(function($ctx2) { return _st(self)._migrateClass_superclass_(each,newClass);
  6564. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6565. _st((function(){
  6566. return smalltalk.withContext(function($ctx2) { return _st(self)._copyClass_to_(oldClass,newClass);
  6567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(exception){
  6568. return smalltalk.withContext(function($ctx2) { $1=self;
  6569. _st($1)._basicRemoveClass_(newClass);
  6570. $2=_st($1)._basicRenameClass_to_(oldClass,aString);
  6571. $2;
  6572. return _st(exception)._signal();
  6573. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  6574. _st(self)._basicRemoveClass_(oldClass);
  6575. $3=newClass;
  6576. return $3;
  6577. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{aString:aString,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass}, smalltalk.ClassBuilder)})},
  6578. args: ["aString", "aClass", "aCollection", "packageName"],
  6579. source: "migrateClassNamed: aString superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass |\x0a \x0a oldClass := Smalltalk current at: aString.\x0a \x0a \x22Rename the old class for existing instances\x22\x0a\x09self basicRenameClass: oldClass to: 'Old', aString.\x0a \x0a newClass := self \x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: aString \x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09oldClass subclasses do: [ :each |\x0a \x09self migrateClass: each superclass: newClass ].\x0a\x0a [ self copyClass: oldClass to: newClass ] \x0a \x09on: Error\x0a do: [ :exception |\x0a \x09self \x0a \x09basicRemoveClass: newClass;\x0a \x09basicRenameClass: oldClass to: aString.\x0a exception signal ].\x0a \x0a self basicRemoveClass: oldClass.\x0a\x09^newClass",
  6580. messageSends: ["at:", "current", "basicRenameClass:to:", ",", "addSubclassOf:named:instanceVariableNames:package:", "do:", "migrateClass:superclass:", "subclasses", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:"],
  6581. referencedClasses: ["Smalltalk", "Error"]
  6582. }),
  6583. smalltalk.ClassBuilder);
  6584. smalltalk.addMethod(
  6585. "_renameClass_to_",
  6586. smalltalk.method({
  6587. selector: "renameClass:to:",
  6588. category: 'api',
  6589. fn: function (aClass,aString){
  6590. var self=this;
  6591. return smalltalk.withContext(function($ctx1) { var $1,$2;
  6592. _st(self)._basicRenameClass_to_(aClass,aString);
  6593. $1=_st((smalltalk.ClassRenamed || ClassRenamed))._new();
  6594. _st($1)._theClass_(aClass);
  6595. $2=_st($1)._yourself();
  6596. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  6597. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  6598. args: ["aClass", "aString"],
  6599. source: "renameClass: aClass to: aString\x0a\x09self basicRenameClass: aClass to: aString.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassRenamed new\x0a \x09theClass: aClass;\x0a yourself)",
  6600. messageSends: ["basicRenameClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  6601. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  6602. }),
  6603. smalltalk.ClassBuilder);
  6604. smalltalk.addMethod(
  6605. "_setupClass_",
  6606. smalltalk.method({
  6607. selector: "setupClass:",
  6608. category: 'api',
  6609. fn: function (aClass){
  6610. var self=this;
  6611. return smalltalk.withContext(function($ctx1) { smalltalk.init(aClass);;
  6612. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass}, smalltalk.ClassBuilder)})},
  6613. args: ["aClass"],
  6614. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  6615. messageSends: [],
  6616. referencedClasses: []
  6617. }),
  6618. smalltalk.ClassBuilder);
  6619. smalltalk.addMethod(
  6620. "_superclass_subclass_",
  6621. smalltalk.method({
  6622. selector: "superclass:subclass:",
  6623. category: 'api',
  6624. fn: function (aClass,aString){
  6625. var self=this;
  6626. return smalltalk.withContext(function($ctx1) { var $1;
  6627. $1=_st(self)._superclass_subclass_instanceVariableNames_package_(aClass,aString,"",nil);
  6628. return $1;
  6629. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  6630. args: ["aClass", "aString"],
  6631. source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
  6632. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  6633. referencedClasses: []
  6634. }),
  6635. smalltalk.ClassBuilder);
  6636. smalltalk.addMethod(
  6637. "_superclass_subclass_instanceVariableNames_package_",
  6638. smalltalk.method({
  6639. selector: "superclass:subclass:instanceVariableNames:package:",
  6640. category: 'api',
  6641. fn: function (aClass,aString,aString2,aString3){
  6642. var self=this;
  6643. var newClass;
  6644. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  6645. $1=self;
  6646. $2=aClass;
  6647. $3=aString;
  6648. $4=_st(self)._instanceVariableNamesFor_(aString2);
  6649. $6=aString3;
  6650. if(($receiver = $6) == nil || $receiver == undefined){
  6651. $5="unclassified";
  6652. } else {
  6653. $5=$6;
  6654. };
  6655. newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5);
  6656. _st(self)._setupClass_(newClass);
  6657. $7=_st((smalltalk.ClassAdded || ClassAdded))._new();
  6658. _st($7)._theClass_(newClass);
  6659. $8=_st($7)._yourself();
  6660. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($8);
  6661. $9=newClass;
  6662. return $9;
  6663. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,aString:aString,aString2:aString2,aString3:aString3,newClass:newClass}, smalltalk.ClassBuilder)})},
  6664. args: ["aClass", "aString", "aString2", "aString3"],
  6665. source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09\x0a newClass := self addSubclassOf: aClass\x0a\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a \x0a SystemAnnouncer current \x0a \x09announce: (ClassAdded new\x0a \x09theClass: newClass;\x0a yourself).\x0a \x0a\x09^newClass",
  6666. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  6667. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  6668. }),
  6669. smalltalk.ClassBuilder);
  6670. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  6671. smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
  6672. smalltalk.addMethod(
  6673. "_class_category_",
  6674. smalltalk.method({
  6675. selector: "class:category:",
  6676. category: 'accessing',
  6677. fn: function (aClass,aString){
  6678. var self=this;
  6679. return smalltalk.withContext(function($ctx1) { self["@class"]=aClass;
  6680. self["@category"]=aString;
  6681. return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString}, smalltalk.ClassCategoryReader)})},
  6682. args: ["aClass", "aString"],
  6683. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  6684. messageSends: [],
  6685. referencedClasses: []
  6686. }),
  6687. smalltalk.ClassCategoryReader);
  6688. smalltalk.addMethod(
  6689. "_compileMethod_",
  6690. smalltalk.method({
  6691. selector: "compileMethod:",
  6692. category: 'private',
  6693. fn: function (aString){
  6694. var self=this;
  6695. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
  6696. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString}, smalltalk.ClassCategoryReader)})},
  6697. args: ["aString"],
  6698. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  6699. messageSends: ["install:forClass:category:", "new"],
  6700. referencedClasses: ["Compiler"]
  6701. }),
  6702. smalltalk.ClassCategoryReader);
  6703. smalltalk.addMethod(
  6704. "_initialize",
  6705. smalltalk.method({
  6706. selector: "initialize",
  6707. category: 'initialization',
  6708. fn: function (){
  6709. var self=this;
  6710. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  6711. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ClassCategoryReader)})},
  6712. args: [],
  6713. source: "initialize\x0a\x09super initialize.",
  6714. messageSends: ["initialize"],
  6715. referencedClasses: []
  6716. }),
  6717. smalltalk.ClassCategoryReader);
  6718. smalltalk.addMethod(
  6719. "_scanFrom_",
  6720. smalltalk.method({
  6721. selector: "scanFrom:",
  6722. category: 'fileIn',
  6723. fn: function (aChunkParser){
  6724. var self=this;
  6725. var chunk;
  6726. return smalltalk.withContext(function($ctx1) { _st((function(){
  6727. return smalltalk.withContext(function($ctx2) { chunk=_st(aChunkParser)._nextChunk();
  6728. chunk;
  6729. return _st(chunk)._isEmpty();
  6730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  6731. return smalltalk.withContext(function($ctx2) { return _st(self)._compileMethod_(chunk);
  6732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6733. _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._setupClass_(self["@class"]);
  6734. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk}, smalltalk.ClassCategoryReader)})},
  6735. args: ["aChunkParser"],
  6736. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09 self compileMethod: chunk].\x0a\x09ClassBuilder new setupClass: class",
  6737. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  6738. referencedClasses: ["ClassBuilder"]
  6739. }),
  6740. smalltalk.ClassCategoryReader);
  6741. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  6742. smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class comments stored on a file.\x0aSee `ClassCategoryReader` too."
  6743. smalltalk.addMethod(
  6744. "_class_",
  6745. smalltalk.method({
  6746. selector: "class:",
  6747. category: 'accessing',
  6748. fn: function (aClass){
  6749. var self=this;
  6750. return smalltalk.withContext(function($ctx1) { self["@class"]=aClass;
  6751. return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass}, smalltalk.ClassCommentReader)})},
  6752. args: ["aClass"],
  6753. source: "class: aClass\x0a\x09class := aClass",
  6754. messageSends: [],
  6755. referencedClasses: []
  6756. }),
  6757. smalltalk.ClassCommentReader);
  6758. smalltalk.addMethod(
  6759. "_initialize",
  6760. smalltalk.method({
  6761. selector: "initialize",
  6762. category: 'initialization',
  6763. fn: function (){
  6764. var self=this;
  6765. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  6766. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ClassCommentReader)})},
  6767. args: [],
  6768. source: "initialize\x0a\x09super initialize.",
  6769. messageSends: ["initialize"],
  6770. referencedClasses: []
  6771. }),
  6772. smalltalk.ClassCommentReader);
  6773. smalltalk.addMethod(
  6774. "_scanFrom_",
  6775. smalltalk.method({
  6776. selector: "scanFrom:",
  6777. category: 'fileIn',
  6778. fn: function (aChunkParser){
  6779. var self=this;
  6780. var chunk;
  6781. return smalltalk.withContext(function($ctx1) { var $1;
  6782. chunk=_st(aChunkParser)._nextChunk();
  6783. $1=_st(chunk)._isEmpty();
  6784. if(! smalltalk.assert($1)){
  6785. _st(self)._setComment_(chunk);
  6786. };
  6787. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk}, smalltalk.ClassCommentReader)})},
  6788. args: ["aChunkParser"],
  6789. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09 self setComment: chunk].",
  6790. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  6791. referencedClasses: []
  6792. }),
  6793. smalltalk.ClassCommentReader);
  6794. smalltalk.addMethod(
  6795. "_setComment_",
  6796. smalltalk.method({
  6797. selector: "setComment:",
  6798. category: 'private',
  6799. fn: function (aString){
  6800. var self=this;
  6801. return smalltalk.withContext(function($ctx1) { _st(self["@class"])._comment_(aString);
  6802. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString}, smalltalk.ClassCommentReader)})},
  6803. args: ["aString"],
  6804. source: "setComment: aString\x0a class comment: aString",
  6805. messageSends: ["comment:"],
  6806. referencedClasses: []
  6807. }),
  6808. smalltalk.ClassCommentReader);
  6809. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  6810. smalltalk.addMethod(
  6811. "_getNodesFrom_",
  6812. smalltalk.method({
  6813. selector: "getNodesFrom:",
  6814. category: 'accessing',
  6815. fn: function (aCollection){
  6816. var self=this;
  6817. var children,others;
  6818. return smalltalk.withContext(function($ctx1) { var $1;
  6819. children=[];
  6820. others=[];
  6821. _st(aCollection)._do_((function(each){
  6822. return smalltalk.withContext(function($ctx2) { $1=_st(_st(each)._superclass()).__eq(_st(self)._theClass());
  6823. if(smalltalk.assert($1)){
  6824. return _st(children)._add_(each);
  6825. } else {
  6826. return _st(others)._add_(each);
  6827. };
  6828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6829. self["@nodes"]=_st(children)._collect_((function(each){
  6830. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.ClassSorterNode || ClassSorterNode))._on_classes_level_(each,others,_st(_st(self)._level()).__plus((1)));
  6831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6832. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others}, smalltalk.ClassSorterNode)})},
  6833. args: ["aCollection"],
  6834. 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]",
  6835. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  6836. referencedClasses: ["ClassSorterNode"]
  6837. }),
  6838. smalltalk.ClassSorterNode);
  6839. smalltalk.addMethod(
  6840. "_level",
  6841. smalltalk.method({
  6842. selector: "level",
  6843. category: 'accessing',
  6844. fn: function (){
  6845. var self=this;
  6846. return smalltalk.withContext(function($ctx1) { var $1;
  6847. $1=self["@level"];
  6848. return $1;
  6849. }, function($ctx1) {$ctx1.fill(self,"level",{}, smalltalk.ClassSorterNode)})},
  6850. args: [],
  6851. source: "level\x0a\x09^level",
  6852. messageSends: [],
  6853. referencedClasses: []
  6854. }),
  6855. smalltalk.ClassSorterNode);
  6856. smalltalk.addMethod(
  6857. "_level_",
  6858. smalltalk.method({
  6859. selector: "level:",
  6860. category: 'accessing',
  6861. fn: function (anInteger){
  6862. var self=this;
  6863. return smalltalk.withContext(function($ctx1) { self["@level"]=anInteger;
  6864. return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger}, smalltalk.ClassSorterNode)})},
  6865. args: ["anInteger"],
  6866. source: "level: anInteger\x0a\x09level := anInteger",
  6867. messageSends: [],
  6868. referencedClasses: []
  6869. }),
  6870. smalltalk.ClassSorterNode);
  6871. smalltalk.addMethod(
  6872. "_nodes",
  6873. smalltalk.method({
  6874. selector: "nodes",
  6875. category: 'accessing',
  6876. fn: function (){
  6877. var self=this;
  6878. return smalltalk.withContext(function($ctx1) { var $1;
  6879. $1=self["@nodes"];
  6880. return $1;
  6881. }, function($ctx1) {$ctx1.fill(self,"nodes",{}, smalltalk.ClassSorterNode)})},
  6882. args: [],
  6883. source: "nodes\x0a\x09^nodes",
  6884. messageSends: [],
  6885. referencedClasses: []
  6886. }),
  6887. smalltalk.ClassSorterNode);
  6888. smalltalk.addMethod(
  6889. "_theClass",
  6890. smalltalk.method({
  6891. selector: "theClass",
  6892. category: 'accessing',
  6893. fn: function (){
  6894. var self=this;
  6895. return smalltalk.withContext(function($ctx1) { var $1;
  6896. $1=self["@theClass"];
  6897. return $1;
  6898. }, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.ClassSorterNode)})},
  6899. args: [],
  6900. source: "theClass\x0a\x09^theClass",
  6901. messageSends: [],
  6902. referencedClasses: []
  6903. }),
  6904. smalltalk.ClassSorterNode);
  6905. smalltalk.addMethod(
  6906. "_theClass_",
  6907. smalltalk.method({
  6908. selector: "theClass:",
  6909. category: 'accessing',
  6910. fn: function (aClass){
  6911. var self=this;
  6912. return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass;
  6913. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass}, smalltalk.ClassSorterNode)})},
  6914. args: ["aClass"],
  6915. source: "theClass: aClass\x0a\x09theClass := aClass",
  6916. messageSends: [],
  6917. referencedClasses: []
  6918. }),
  6919. smalltalk.ClassSorterNode);
  6920. smalltalk.addMethod(
  6921. "_traverseClassesWith_",
  6922. smalltalk.method({
  6923. selector: "traverseClassesWith:",
  6924. category: 'visiting',
  6925. fn: function (aCollection){
  6926. var self=this;
  6927. return smalltalk.withContext(function($ctx1) { _st(aCollection)._add_(_st(self)._theClass());
  6928. _st(_st(_st(self)._nodes())._sorted_((function(a,b){
  6929. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  6930. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(aNode){
  6931. return smalltalk.withContext(function($ctx2) { return _st(aNode)._traverseClassesWith_(aCollection);
  6932. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  6933. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection}, smalltalk.ClassSorterNode)})},
  6934. args: ["aCollection"],
  6935. 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 ].",
  6936. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  6937. referencedClasses: []
  6938. }),
  6939. smalltalk.ClassSorterNode);
  6940. smalltalk.addMethod(
  6941. "_on_classes_level_",
  6942. smalltalk.method({
  6943. selector: "on:classes:level:",
  6944. category: 'instance creation',
  6945. fn: function (aClass,aCollection,anInteger){
  6946. var self=this;
  6947. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  6948. $2=_st(self)._new();
  6949. _st($2)._theClass_(aClass);
  6950. _st($2)._level_(anInteger);
  6951. _st($2)._getNodesFrom_(aCollection);
  6952. $3=_st($2)._yourself();
  6953. $1=$3;
  6954. return $1;
  6955. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger}, smalltalk.ClassSorterNode.klass)})},
  6956. args: ["aClass", "aCollection", "anInteger"],
  6957. 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",
  6958. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  6959. referencedClasses: []
  6960. }),
  6961. smalltalk.ClassSorterNode.klass);
  6962. smalltalk.addPackage('Kernel-Methods', {});
  6963. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  6964. smalltalk.BlockClosure.comment="A BlockClosure is a lexical closure.\x0aThe JavaScript representation is a function.\x0a\x0aA BlockClosure is evaluated with the `#value*` methods in the 'evaluating' protocol."
  6965. smalltalk.addMethod(
  6966. "_applyTo_arguments_",
  6967. smalltalk.method({
  6968. selector: "applyTo:arguments:",
  6969. category: 'evaluating',
  6970. fn: function (anObject,aCollection){
  6971. var self=this;
  6972. return smalltalk.withContext(function($ctx1) { return self.apply(anObject, aCollection);
  6973. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection}, smalltalk.BlockClosure)})},
  6974. args: ["anObject", "aCollection"],
  6975. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  6976. messageSends: [],
  6977. referencedClasses: []
  6978. }),
  6979. smalltalk.BlockClosure);
  6980. smalltalk.addMethod(
  6981. "_asCompiledMethod_",
  6982. smalltalk.method({
  6983. selector: "asCompiledMethod:",
  6984. category: 'converting',
  6985. fn: function (aString){
  6986. var self=this;
  6987. return smalltalk.withContext(function($ctx1) { return smalltalk.method({selector:aString, fn:self});;
  6988. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString}, smalltalk.BlockClosure)})},
  6989. args: ["aString"],
  6990. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  6991. messageSends: [],
  6992. referencedClasses: []
  6993. }),
  6994. smalltalk.BlockClosure);
  6995. smalltalk.addMethod(
  6996. "_compiledSource",
  6997. smalltalk.method({
  6998. selector: "compiledSource",
  6999. category: 'accessing',
  7000. fn: function (){
  7001. var self=this;
  7002. return smalltalk.withContext(function($ctx1) { return self.toString();
  7003. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{}, smalltalk.BlockClosure)})},
  7004. args: [],
  7005. source: "compiledSource\x0a\x09<return self.toString()>",
  7006. messageSends: [],
  7007. referencedClasses: []
  7008. }),
  7009. smalltalk.BlockClosure);
  7010. smalltalk.addMethod(
  7011. "_currySelf",
  7012. smalltalk.method({
  7013. selector: "currySelf",
  7014. category: 'converting',
  7015. fn: function (){
  7016. var self=this;
  7017. return smalltalk.withContext(function($ctx1) {
  7018. return function () {
  7019. var args = [ this ];
  7020. args.push.apply(args, arguments);
  7021. return self.apply(null, args);
  7022. }
  7023. ;
  7024. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{}, smalltalk.BlockClosure)})},
  7025. args: [],
  7026. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a which represents JS function (selfarg, x, y, ...) {jscode}\x0a into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a \x0a <\x0a \x09return function () {\x0a \x09\x09var args = [ this ];\x0a \x09args.push.apply(args, arguments);\x0a \x09return self.apply(null, args);\x0a \x09}\x0a\x09>",
  7027. messageSends: [],
  7028. referencedClasses: []
  7029. }),
  7030. smalltalk.BlockClosure);
  7031. smalltalk.addMethod(
  7032. "_ensure_",
  7033. smalltalk.method({
  7034. selector: "ensure:",
  7035. category: 'evaluating',
  7036. fn: function (aBlock){
  7037. var self=this;
  7038. return smalltalk.withContext(function($ctx1) { try{return self()}finally{aBlock._value()};
  7039. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock}, smalltalk.BlockClosure)})},
  7040. args: ["aBlock"],
  7041. source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
  7042. messageSends: [],
  7043. referencedClasses: []
  7044. }),
  7045. smalltalk.BlockClosure);
  7046. smalltalk.addMethod(
  7047. "_fork",
  7048. smalltalk.method({
  7049. selector: "fork",
  7050. category: 'timeout/interval',
  7051. fn: function (){
  7052. var self=this;
  7053. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.ForkPool || ForkPool))._default())._fork_(self);
  7054. return self}, function($ctx1) {$ctx1.fill(self,"fork",{}, smalltalk.BlockClosure)})},
  7055. args: [],
  7056. source: "fork\x0a\x09ForkPool default fork: self",
  7057. messageSends: ["fork:", "default"],
  7058. referencedClasses: ["ForkPool"]
  7059. }),
  7060. smalltalk.BlockClosure);
  7061. smalltalk.addMethod(
  7062. "_new",
  7063. smalltalk.method({
  7064. selector: "new",
  7065. category: 'evaluating',
  7066. fn: function (){
  7067. var self=this;
  7068. return smalltalk.withContext(function($ctx1) { return new self();
  7069. return self}, function($ctx1) {$ctx1.fill(self,"new",{}, smalltalk.BlockClosure)})},
  7070. args: [],
  7071. 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()>",
  7072. messageSends: [],
  7073. referencedClasses: []
  7074. }),
  7075. smalltalk.BlockClosure);
  7076. smalltalk.addMethod(
  7077. "_newValue_",
  7078. smalltalk.method({
  7079. selector: "newValue:",
  7080. category: 'evaluating',
  7081. fn: function (anObject){
  7082. var self=this;
  7083. return smalltalk.withContext(function($ctx1) { return new self(anObject);
  7084. return self}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject}, smalltalk.BlockClosure)})},
  7085. args: ["anObject"],
  7086. 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)>",
  7087. messageSends: [],
  7088. referencedClasses: []
  7089. }),
  7090. smalltalk.BlockClosure);
  7091. smalltalk.addMethod(
  7092. "_newValue_value_",
  7093. smalltalk.method({
  7094. selector: "newValue:value:",
  7095. category: 'evaluating',
  7096. fn: function (anObject,anObject2){
  7097. var self=this;
  7098. return smalltalk.withContext(function($ctx1) { return new self(anObject, anObject2);
  7099. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2}, smalltalk.BlockClosure)})},
  7100. args: ["anObject", "anObject2"],
  7101. 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)>",
  7102. messageSends: [],
  7103. referencedClasses: []
  7104. }),
  7105. smalltalk.BlockClosure);
  7106. smalltalk.addMethod(
  7107. "_newValue_value_value_",
  7108. smalltalk.method({
  7109. selector: "newValue:value:value:",
  7110. category: 'evaluating',
  7111. fn: function (anObject,anObject2,anObject3){
  7112. var self=this;
  7113. return smalltalk.withContext(function($ctx1) { return new self(anObject, anObject2,anObject3);
  7114. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.BlockClosure)})},
  7115. args: ["anObject", "anObject2", "anObject3"],
  7116. 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)>",
  7117. messageSends: [],
  7118. referencedClasses: []
  7119. }),
  7120. smalltalk.BlockClosure);
  7121. smalltalk.addMethod(
  7122. "_numArgs",
  7123. smalltalk.method({
  7124. selector: "numArgs",
  7125. category: 'accessing',
  7126. fn: function (){
  7127. var self=this;
  7128. return smalltalk.withContext(function($ctx1) { return self.length;
  7129. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{}, smalltalk.BlockClosure)})},
  7130. args: [],
  7131. source: "numArgs\x0a\x09<return self.length>",
  7132. messageSends: [],
  7133. referencedClasses: []
  7134. }),
  7135. smalltalk.BlockClosure);
  7136. smalltalk.addMethod(
  7137. "_on_do_",
  7138. smalltalk.method({
  7139. selector: "on:do:",
  7140. category: 'error handling',
  7141. fn: function (anErrorClass,aBlock){
  7142. var self=this;
  7143. return smalltalk.withContext(function($ctx1) { var $2,$1;
  7144. $1=_st(self)._try_catch_(self,(function(error){
  7145. var smalltalkError;
  7146. return smalltalk.withContext(function($ctx2) { smalltalkError=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._asSmalltalkException_(error);
  7147. smalltalkError;
  7148. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  7149. if(smalltalk.assert($2)){
  7150. return _st(aBlock)._value_(smalltalkError);
  7151. } else {
  7152. return _st(smalltalkError)._signal();
  7153. };
  7154. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
  7155. return $1;
  7156. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock}, smalltalk.BlockClosure)})},
  7157. args: ["anErrorClass", "aBlock"],
  7158. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a Convert all JS exceptions to JavaScriptException instances.\x22\x0a \x0a\x09^self try: self catch: [ :error | | smalltalkError |\x0a \x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09 (smalltalkError isKindOf: anErrorClass) \x0a\x09 ifTrue: [ aBlock value: smalltalkError ]\x0a\x09 ifFalse: [ smalltalkError signal ] ]",
  7159. messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
  7160. referencedClasses: ["Smalltalk"]
  7161. }),
  7162. smalltalk.BlockClosure);
  7163. smalltalk.addMethod(
  7164. "_timeToRun",
  7165. smalltalk.method({
  7166. selector: "timeToRun",
  7167. category: 'evaluating',
  7168. fn: function (){
  7169. var self=this;
  7170. return smalltalk.withContext(function($ctx1) { var $1;
  7171. $1=_st((smalltalk.Date || Date))._millisecondsToRun_(self);
  7172. return $1;
  7173. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{}, smalltalk.BlockClosure)})},
  7174. args: [],
  7175. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7176. messageSends: ["millisecondsToRun:"],
  7177. referencedClasses: ["Date"]
  7178. }),
  7179. smalltalk.BlockClosure);
  7180. smalltalk.addMethod(
  7181. "_value",
  7182. smalltalk.method({
  7183. selector: "value",
  7184. category: 'evaluating',
  7185. fn: function (){
  7186. var self=this;
  7187. return smalltalk.withContext(function($ctx1) { return self();;
  7188. return self}, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.BlockClosure)})},
  7189. args: [],
  7190. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  7191. messageSends: [],
  7192. referencedClasses: []
  7193. }),
  7194. smalltalk.BlockClosure);
  7195. smalltalk.addMethod(
  7196. "_value_",
  7197. smalltalk.method({
  7198. selector: "value:",
  7199. category: 'evaluating',
  7200. fn: function (anArg){
  7201. var self=this;
  7202. return smalltalk.withContext(function($ctx1) { return self(anArg);;
  7203. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg}, smalltalk.BlockClosure)})},
  7204. args: ["anArg"],
  7205. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  7206. messageSends: [],
  7207. referencedClasses: []
  7208. }),
  7209. smalltalk.BlockClosure);
  7210. smalltalk.addMethod(
  7211. "_value_value_",
  7212. smalltalk.method({
  7213. selector: "value:value:",
  7214. category: 'evaluating',
  7215. fn: function (firstArg,secondArg){
  7216. var self=this;
  7217. return smalltalk.withContext(function($ctx1) { return self(firstArg, secondArg);;
  7218. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg}, smalltalk.BlockClosure)})},
  7219. args: ["firstArg", "secondArg"],
  7220. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  7221. messageSends: [],
  7222. referencedClasses: []
  7223. }),
  7224. smalltalk.BlockClosure);
  7225. smalltalk.addMethod(
  7226. "_value_value_value_",
  7227. smalltalk.method({
  7228. selector: "value:value:value:",
  7229. category: 'evaluating',
  7230. fn: function (firstArg,secondArg,thirdArg){
  7231. var self=this;
  7232. return smalltalk.withContext(function($ctx1) { return self(firstArg, secondArg, thirdArg);;
  7233. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg}, smalltalk.BlockClosure)})},
  7234. args: ["firstArg", "secondArg", "thirdArg"],
  7235. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7236. messageSends: [],
  7237. referencedClasses: []
  7238. }),
  7239. smalltalk.BlockClosure);
  7240. smalltalk.addMethod(
  7241. "_valueWithInterval_",
  7242. smalltalk.method({
  7243. selector: "valueWithInterval:",
  7244. category: 'timeout/interval',
  7245. fn: function (aNumber){
  7246. var self=this;
  7247. return smalltalk.withContext(function($ctx1) {
  7248. var interval = setInterval(self, aNumber);
  7249. return smalltalk.Timeout._on_(interval);
  7250. ;
  7251. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber}, smalltalk.BlockClosure)})},
  7252. args: ["aNumber"],
  7253. source: "valueWithInterval: aNumber\x0a\x09<\x0a \x09var interval = setInterval(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(interval);\x0a >",
  7254. messageSends: [],
  7255. referencedClasses: []
  7256. }),
  7257. smalltalk.BlockClosure);
  7258. smalltalk.addMethod(
  7259. "_valueWithPossibleArguments_",
  7260. smalltalk.method({
  7261. selector: "valueWithPossibleArguments:",
  7262. category: 'evaluating',
  7263. fn: function (aCollection){
  7264. var self=this;
  7265. return smalltalk.withContext(function($ctx1) { return self.apply(null, aCollection);;
  7266. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection}, smalltalk.BlockClosure)})},
  7267. args: ["aCollection"],
  7268. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  7269. messageSends: [],
  7270. referencedClasses: []
  7271. }),
  7272. smalltalk.BlockClosure);
  7273. smalltalk.addMethod(
  7274. "_valueWithTimeout_",
  7275. smalltalk.method({
  7276. selector: "valueWithTimeout:",
  7277. category: 'timeout/interval',
  7278. fn: function (aNumber){
  7279. var self=this;
  7280. return smalltalk.withContext(function($ctx1) {
  7281. var timeout = setTimeout(self, aNumber);
  7282. return smalltalk.Timeout._on_(timeout);
  7283. ;
  7284. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber}, smalltalk.BlockClosure)})},
  7285. args: ["aNumber"],
  7286. source: "valueWithTimeout: aNumber\x0a\x09<\x0a \x09var timeout = setTimeout(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(timeout);\x0a >",
  7287. messageSends: [],
  7288. referencedClasses: []
  7289. }),
  7290. smalltalk.BlockClosure);
  7291. smalltalk.addMethod(
  7292. "_whileFalse",
  7293. smalltalk.method({
  7294. selector: "whileFalse",
  7295. category: 'controlling',
  7296. fn: function (){
  7297. var self=this;
  7298. return smalltalk.withContext(function($ctx1) { _st(self)._whileFalse_((function(){
  7299. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7300. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{}, smalltalk.BlockClosure)})},
  7301. args: [],
  7302. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  7303. messageSends: ["whileFalse:"],
  7304. referencedClasses: []
  7305. }),
  7306. smalltalk.BlockClosure);
  7307. smalltalk.addMethod(
  7308. "_whileFalse_",
  7309. smalltalk.method({
  7310. selector: "whileFalse:",
  7311. category: 'controlling',
  7312. fn: function (aBlock){
  7313. var self=this;
  7314. return smalltalk.withContext(function($ctx1) { while(!self()) {aBlock()};
  7315. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock}, smalltalk.BlockClosure)})},
  7316. args: ["aBlock"],
  7317. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  7318. messageSends: [],
  7319. referencedClasses: []
  7320. }),
  7321. smalltalk.BlockClosure);
  7322. smalltalk.addMethod(
  7323. "_whileTrue",
  7324. smalltalk.method({
  7325. selector: "whileTrue",
  7326. category: 'controlling',
  7327. fn: function (){
  7328. var self=this;
  7329. return smalltalk.withContext(function($ctx1) { _st(self)._whileTrue_((function(){
  7330. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7331. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{}, smalltalk.BlockClosure)})},
  7332. args: [],
  7333. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  7334. messageSends: ["whileTrue:"],
  7335. referencedClasses: []
  7336. }),
  7337. smalltalk.BlockClosure);
  7338. smalltalk.addMethod(
  7339. "_whileTrue_",
  7340. smalltalk.method({
  7341. selector: "whileTrue:",
  7342. category: 'controlling',
  7343. fn: function (aBlock){
  7344. var self=this;
  7345. return smalltalk.withContext(function($ctx1) { while(self()) {aBlock()};
  7346. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock}, smalltalk.BlockClosure)})},
  7347. args: ["aBlock"],
  7348. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  7349. messageSends: [],
  7350. referencedClasses: []
  7351. }),
  7352. smalltalk.BlockClosure);
  7353. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  7354. smalltalk.CompiledMethod.comment="CompiledMethod hold the source and compiled code of a class method.\x0a\x0aYou can get a CompiledMethod using `Behavior>>methodAt:`\x0a\x0a\x09String methodAt: 'lines'\x0a\x0aand read the source code\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aSee referenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aor messages sent from this method:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"
  7355. smalltalk.addMethod(
  7356. "_arguments",
  7357. smalltalk.method({
  7358. selector: "arguments",
  7359. category: 'accessing',
  7360. fn: function (){
  7361. var self=this;
  7362. return smalltalk.withContext(function($ctx1) { return self.args || [];
  7363. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{}, smalltalk.CompiledMethod)})},
  7364. args: [],
  7365. source: "arguments\x0a\x09<return self.args || []>",
  7366. messageSends: [],
  7367. referencedClasses: []
  7368. }),
  7369. smalltalk.CompiledMethod);
  7370. smalltalk.addMethod(
  7371. "_category",
  7372. smalltalk.method({
  7373. selector: "category",
  7374. category: 'accessing',
  7375. fn: function (){
  7376. var self=this;
  7377. return smalltalk.withContext(function($ctx1) { var $2,$1;
  7378. $2=_st(self)._basicAt_("category");
  7379. if(($receiver = $2) == nil || $receiver == undefined){
  7380. $1="";
  7381. } else {
  7382. $1=$2;
  7383. };
  7384. return $1;
  7385. }, function($ctx1) {$ctx1.fill(self,"category",{}, smalltalk.CompiledMethod)})},
  7386. args: [],
  7387. source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
  7388. messageSends: ["ifNil:", "basicAt:"],
  7389. referencedClasses: []
  7390. }),
  7391. smalltalk.CompiledMethod);
  7392. smalltalk.addMethod(
  7393. "_category_",
  7394. smalltalk.method({
  7395. selector: "category:",
  7396. category: 'accessing',
  7397. fn: function (aString){
  7398. var self=this;
  7399. var oldCategory;
  7400. return smalltalk.withContext(function($ctx1) { var $1;
  7401. oldCategory=_st(self)._category();
  7402. _st(self)._basicAt_put_("category",aString);
  7403. $1=_st(self)._methodClass();
  7404. if(($receiver = $1) == nil || $receiver == undefined){
  7405. $1;
  7406. } else {
  7407. _st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
  7408. _st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
  7409. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._category()).__eq(oldCategory);
  7410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
  7411. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldCategory);
  7412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7413. };
  7414. return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldCategory:oldCategory}, smalltalk.CompiledMethod)})},
  7415. args: ["aString"],
  7416. source: "category: aString\x0a\x09| oldCategory |\x0a oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a \x0a self methodClass ifNotNil: [\x0a \x09self methodClass organization addElement: aString.\x0a \x0a\x09\x09(self methodClass methods \x0a \x09\x09select: [ :each | each category = oldCategory ])\x0a \x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
  7417. messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  7418. referencedClasses: []
  7419. }),
  7420. smalltalk.CompiledMethod);
  7421. smalltalk.addMethod(
  7422. "_fn",
  7423. smalltalk.method({
  7424. selector: "fn",
  7425. category: 'accessing',
  7426. fn: function (){
  7427. var self=this;
  7428. return smalltalk.withContext(function($ctx1) { var $1;
  7429. $1=_st(self)._basicAt_("fn");
  7430. return $1;
  7431. }, function($ctx1) {$ctx1.fill(self,"fn",{}, smalltalk.CompiledMethod)})},
  7432. args: [],
  7433. source: "fn\x0a\x09^self basicAt: 'fn'",
  7434. messageSends: ["basicAt:"],
  7435. referencedClasses: []
  7436. }),
  7437. smalltalk.CompiledMethod);
  7438. smalltalk.addMethod(
  7439. "_fn_",
  7440. smalltalk.method({
  7441. selector: "fn:",
  7442. category: 'accessing',
  7443. fn: function (aBlock){
  7444. var self=this;
  7445. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("fn",aBlock);
  7446. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock}, smalltalk.CompiledMethod)})},
  7447. args: ["aBlock"],
  7448. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  7449. messageSends: ["basicAt:put:"],
  7450. referencedClasses: []
  7451. }),
  7452. smalltalk.CompiledMethod);
  7453. smalltalk.addMethod(
  7454. "_messageSends",
  7455. smalltalk.method({
  7456. selector: "messageSends",
  7457. category: 'accessing',
  7458. fn: function (){
  7459. var self=this;
  7460. return smalltalk.withContext(function($ctx1) { var $1;
  7461. $1=_st(self)._basicAt_("messageSends");
  7462. return $1;
  7463. }, function($ctx1) {$ctx1.fill(self,"messageSends",{}, smalltalk.CompiledMethod)})},
  7464. args: [],
  7465. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  7466. messageSends: ["basicAt:"],
  7467. referencedClasses: []
  7468. }),
  7469. smalltalk.CompiledMethod);
  7470. smalltalk.addMethod(
  7471. "_methodClass",
  7472. smalltalk.method({
  7473. selector: "methodClass",
  7474. category: 'accessing',
  7475. fn: function (){
  7476. var self=this;
  7477. return smalltalk.withContext(function($ctx1) { var $1;
  7478. $1=_st(self)._basicAt_("methodClass");
  7479. return $1;
  7480. }, function($ctx1) {$ctx1.fill(self,"methodClass",{}, smalltalk.CompiledMethod)})},
  7481. args: [],
  7482. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  7483. messageSends: ["basicAt:"],
  7484. referencedClasses: []
  7485. }),
  7486. smalltalk.CompiledMethod);
  7487. smalltalk.addMethod(
  7488. "_protocol",
  7489. smalltalk.method({
  7490. selector: "protocol",
  7491. category: 'accessing',
  7492. fn: function (){
  7493. var self=this;
  7494. return smalltalk.withContext(function($ctx1) { var $1;
  7495. $1=_st(self)._category();
  7496. return $1;
  7497. }, function($ctx1) {$ctx1.fill(self,"protocol",{}, smalltalk.CompiledMethod)})},
  7498. args: [],
  7499. source: "protocol\x0a\x09^ self category",
  7500. messageSends: ["category"],
  7501. referencedClasses: []
  7502. }),
  7503. smalltalk.CompiledMethod);
  7504. smalltalk.addMethod(
  7505. "_referencedClasses",
  7506. smalltalk.method({
  7507. selector: "referencedClasses",
  7508. category: 'accessing',
  7509. fn: function (){
  7510. var self=this;
  7511. return smalltalk.withContext(function($ctx1) { var $1;
  7512. $1=_st(self)._basicAt_("referencedClasses");
  7513. return $1;
  7514. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{}, smalltalk.CompiledMethod)})},
  7515. args: [],
  7516. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  7517. messageSends: ["basicAt:"],
  7518. referencedClasses: []
  7519. }),
  7520. smalltalk.CompiledMethod);
  7521. smalltalk.addMethod(
  7522. "_selector",
  7523. smalltalk.method({
  7524. selector: "selector",
  7525. category: 'accessing',
  7526. fn: function (){
  7527. var self=this;
  7528. return smalltalk.withContext(function($ctx1) { var $1;
  7529. $1=_st(self)._basicAt_("selector");
  7530. return $1;
  7531. }, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.CompiledMethod)})},
  7532. args: [],
  7533. source: "selector\x0a\x09^self basicAt: 'selector'",
  7534. messageSends: ["basicAt:"],
  7535. referencedClasses: []
  7536. }),
  7537. smalltalk.CompiledMethod);
  7538. smalltalk.addMethod(
  7539. "_selector_",
  7540. smalltalk.method({
  7541. selector: "selector:",
  7542. category: 'accessing',
  7543. fn: function (aString){
  7544. var self=this;
  7545. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("selector",aString);
  7546. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString}, smalltalk.CompiledMethod)})},
  7547. args: ["aString"],
  7548. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  7549. messageSends: ["basicAt:put:"],
  7550. referencedClasses: []
  7551. }),
  7552. smalltalk.CompiledMethod);
  7553. smalltalk.addMethod(
  7554. "_source",
  7555. smalltalk.method({
  7556. selector: "source",
  7557. category: 'accessing',
  7558. fn: function (){
  7559. var self=this;
  7560. return smalltalk.withContext(function($ctx1) { var $2,$1;
  7561. $2=_st(self)._basicAt_("source");
  7562. if(($receiver = $2) == nil || $receiver == undefined){
  7563. $1="";
  7564. } else {
  7565. $1=$2;
  7566. };
  7567. return $1;
  7568. }, function($ctx1) {$ctx1.fill(self,"source",{}, smalltalk.CompiledMethod)})},
  7569. args: [],
  7570. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  7571. messageSends: ["ifNil:", "basicAt:"],
  7572. referencedClasses: []
  7573. }),
  7574. smalltalk.CompiledMethod);
  7575. smalltalk.addMethod(
  7576. "_source_",
  7577. smalltalk.method({
  7578. selector: "source:",
  7579. category: 'accessing',
  7580. fn: function (aString){
  7581. var self=this;
  7582. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("source",aString);
  7583. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString}, smalltalk.CompiledMethod)})},
  7584. args: ["aString"],
  7585. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  7586. messageSends: ["basicAt:put:"],
  7587. referencedClasses: []
  7588. }),
  7589. smalltalk.CompiledMethod);
  7590. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  7591. smalltalk.ForkPool.comment="A ForkPool is responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0aThe default instance is accessed with `ForkPool default`"
  7592. smalltalk.addMethod(
  7593. "_addWorker",
  7594. smalltalk.method({
  7595. selector: "addWorker",
  7596. category: 'private',
  7597. fn: function (){
  7598. var self=this;
  7599. return smalltalk.withContext(function($ctx1) { _st(self["@worker"])._valueWithTimeout_((0));
  7600. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  7601. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{}, smalltalk.ForkPool)})},
  7602. args: [],
  7603. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a poolSize := poolSize + 1",
  7604. messageSends: ["valueWithTimeout:", "+"],
  7605. referencedClasses: []
  7606. }),
  7607. smalltalk.ForkPool);
  7608. smalltalk.addMethod(
  7609. "_defaultMaxPoolSize",
  7610. smalltalk.method({
  7611. selector: "defaultMaxPoolSize",
  7612. category: 'defaults',
  7613. fn: function (){
  7614. var self=this;
  7615. return smalltalk.withContext(function($ctx1) { var $1;
  7616. $1=_st(_st(self)._class())._defaultMaxPoolSize();
  7617. return $1;
  7618. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{}, smalltalk.ForkPool)})},
  7619. args: [],
  7620. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  7621. messageSends: ["defaultMaxPoolSize", "class"],
  7622. referencedClasses: []
  7623. }),
  7624. smalltalk.ForkPool);
  7625. smalltalk.addMethod(
  7626. "_fork_",
  7627. smalltalk.method({
  7628. selector: "fork:",
  7629. category: 'actions',
  7630. fn: function (aBlock){
  7631. var self=this;
  7632. return smalltalk.withContext(function($ctx1) { var $1;
  7633. $1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize());
  7634. if(smalltalk.assert($1)){
  7635. _st(self)._addWorker();
  7636. };
  7637. _st(self["@queue"])._back_(aBlock);
  7638. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock}, smalltalk.ForkPool)})},
  7639. args: ["aBlock"],
  7640. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
  7641. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "back:"],
  7642. referencedClasses: []
  7643. }),
  7644. smalltalk.ForkPool);
  7645. smalltalk.addMethod(
  7646. "_initialize",
  7647. smalltalk.method({
  7648. selector: "initialize",
  7649. category: 'initialization',
  7650. fn: function (){
  7651. var self=this;
  7652. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  7653. self["@poolSize"]=(0);
  7654. self["@queue"]=_st((smalltalk.Queue || Queue))._new();
  7655. self["@worker"]=_st(self)._makeWorker();
  7656. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ForkPool)})},
  7657. args: [],
  7658. source: "initialize\x0a super initialize.\x0a \x0a\x09poolSize := 0.\x0a queue := Queue new.\x0a worker := self makeWorker",
  7659. messageSends: ["initialize", "new", "makeWorker"],
  7660. referencedClasses: ["Queue"]
  7661. }),
  7662. smalltalk.ForkPool);
  7663. smalltalk.addMethod(
  7664. "_makeWorker",
  7665. smalltalk.method({
  7666. selector: "makeWorker",
  7667. category: 'initialization',
  7668. fn: function (){
  7669. var self=this;
  7670. var sentinel;
  7671. return smalltalk.withContext(function($ctx1) { var $2,$1;
  7672. sentinel=_st((smalltalk.Object || Object))._new();
  7673. $1=(function(){
  7674. var block;
  7675. return smalltalk.withContext(function($ctx2) { self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  7676. self["@poolSize"];
  7677. block=_st(self["@queue"])._frontIfAbsent_((function(){
  7678. return smalltalk.withContext(function($ctx3) { return sentinel;
  7679. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  7680. block;
  7681. $2=_st(block).__eq_eq(sentinel);
  7682. if(! smalltalk.assert($2)){
  7683. return _st((function(){
  7684. return smalltalk.withContext(function($ctx3) { return _st(block)._value();
  7685. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  7686. return smalltalk.withContext(function($ctx3) { return _st(self)._addWorker();
  7687. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  7688. };
  7689. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
  7690. return $1;
  7691. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel}, smalltalk.ForkPool)})},
  7692. args: [],
  7693. source: "makeWorker\x0a\x09| sentinel |\x0a sentinel := Object new.\x0a ^[ | block |\x0a poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a block == sentinel ifFalse: [\x0a \x09[ block value ] ensure: [ self addWorker ]]]",
  7694. messageSends: ["new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  7695. referencedClasses: ["Object"]
  7696. }),
  7697. smalltalk.ForkPool);
  7698. smalltalk.addMethod(
  7699. "_maxPoolSize",
  7700. smalltalk.method({
  7701. selector: "maxPoolSize",
  7702. category: 'accessing',
  7703. fn: function (){
  7704. var self=this;
  7705. return smalltalk.withContext(function($ctx1) { var $2,$1;
  7706. $2=self["@maxPoolSize"];
  7707. if(($receiver = $2) == nil || $receiver == undefined){
  7708. $1=_st(self)._defaultMaxPoolSize();
  7709. } else {
  7710. $1=$2;
  7711. };
  7712. return $1;
  7713. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{}, smalltalk.ForkPool)})},
  7714. args: [],
  7715. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  7716. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  7717. referencedClasses: []
  7718. }),
  7719. smalltalk.ForkPool);
  7720. smalltalk.addMethod(
  7721. "_maxPoolSize_",
  7722. smalltalk.method({
  7723. selector: "maxPoolSize:",
  7724. category: 'accessing',
  7725. fn: function (anInteger){
  7726. var self=this;
  7727. return smalltalk.withContext(function($ctx1) { self["@maxPoolSize"]=anInteger;
  7728. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger}, smalltalk.ForkPool)})},
  7729. args: ["anInteger"],
  7730. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  7731. messageSends: [],
  7732. referencedClasses: []
  7733. }),
  7734. smalltalk.ForkPool);
  7735. smalltalk.ForkPool.klass.iVarNames = ['default'];
  7736. smalltalk.addMethod(
  7737. "_default",
  7738. smalltalk.method({
  7739. selector: "default",
  7740. category: 'accessing',
  7741. fn: function (){
  7742. var self=this;
  7743. return smalltalk.withContext(function($ctx1) { var $2,$1;
  7744. $2=self["@default"];
  7745. if(($receiver = $2) == nil || $receiver == undefined){
  7746. self["@default"]=_st(self)._new();
  7747. $1=self["@default"];
  7748. } else {
  7749. $1=$2;
  7750. };
  7751. return $1;
  7752. }, function($ctx1) {$ctx1.fill(self,"default",{}, smalltalk.ForkPool.klass)})},
  7753. args: [],
  7754. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  7755. messageSends: ["ifNil:", "new"],
  7756. referencedClasses: []
  7757. }),
  7758. smalltalk.ForkPool.klass);
  7759. smalltalk.addMethod(
  7760. "_defaultMaxPoolSize",
  7761. smalltalk.method({
  7762. selector: "defaultMaxPoolSize",
  7763. category: 'accessing',
  7764. fn: function (){
  7765. var self=this;
  7766. return smalltalk.withContext(function($ctx1) { return (100);
  7767. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{}, smalltalk.ForkPool.klass)})},
  7768. args: [],
  7769. source: "defaultMaxPoolSize\x0a\x09^100",
  7770. messageSends: [],
  7771. referencedClasses: []
  7772. }),
  7773. smalltalk.ForkPool.klass);
  7774. smalltalk.addMethod(
  7775. "_resetDefault",
  7776. smalltalk.method({
  7777. selector: "resetDefault",
  7778. category: 'accessing',
  7779. fn: function (){
  7780. var self=this;
  7781. return smalltalk.withContext(function($ctx1) { self["@default"]=nil;
  7782. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{}, smalltalk.ForkPool.klass)})},
  7783. args: [],
  7784. source: "resetDefault\x0a\x09default := nil",
  7785. messageSends: [],
  7786. referencedClasses: []
  7787. }),
  7788. smalltalk.ForkPool.klass);
  7789. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  7790. smalltalk.Message.comment="Generally, the system does not use instances of Message for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission. \x0aThis instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object>>doesNotUnderstand:`"
  7791. smalltalk.addMethod(
  7792. "_arguments",
  7793. smalltalk.method({
  7794. selector: "arguments",
  7795. category: 'accessing',
  7796. fn: function (){
  7797. var self=this;
  7798. return smalltalk.withContext(function($ctx1) { var $1;
  7799. $1=self["@arguments"];
  7800. return $1;
  7801. }, function($ctx1) {$ctx1.fill(self,"arguments",{}, smalltalk.Message)})},
  7802. args: [],
  7803. source: "arguments\x0a\x09^arguments",
  7804. messageSends: [],
  7805. referencedClasses: []
  7806. }),
  7807. smalltalk.Message);
  7808. smalltalk.addMethod(
  7809. "_arguments_",
  7810. smalltalk.method({
  7811. selector: "arguments:",
  7812. category: 'accessing',
  7813. fn: function (anArray){
  7814. var self=this;
  7815. return smalltalk.withContext(function($ctx1) { self["@arguments"]=anArray;
  7816. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray}, smalltalk.Message)})},
  7817. args: ["anArray"],
  7818. source: "arguments: anArray\x0a\x09arguments := anArray",
  7819. messageSends: [],
  7820. referencedClasses: []
  7821. }),
  7822. smalltalk.Message);
  7823. smalltalk.addMethod(
  7824. "_printString",
  7825. smalltalk.method({
  7826. selector: "printString",
  7827. category: 'printing',
  7828. fn: function (){
  7829. var self=this;
  7830. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  7831. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  7832. return smalltalk.withContext(function($ctx2) { $2=aStream;
  7833. _st($2)._nextPutAll_(smalltalk.Object.fn.prototype._printString.apply(_st(self), []));
  7834. _st($2)._nextPutAll_("(");
  7835. _st($2)._nextPutAll_(self["@selector"]);
  7836. $3=_st($2)._nextPutAll_(")");
  7837. return $3;
  7838. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  7839. return $1;
  7840. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Message)})},
  7841. args: [],
  7842. source: "printString\x0a\x09^ String streamContents: [:aStream| \x0a \x09\x09\x09\x09aStream \x0a \x09\x09\x09\x09\x09nextPutAll: super printString;\x0a \x09\x09\x09\x09\x09nextPutAll: '(';\x0a \x09\x09\x09\x09\x09nextPutAll: selector;\x0a \x09\x09\x09\x09\x09nextPutAll: ')' \x09\x09\x09\x09]",
  7843. messageSends: ["streamContents:", "nextPutAll:", "printString"],
  7844. referencedClasses: ["String"]
  7845. }),
  7846. smalltalk.Message);
  7847. smalltalk.addMethod(
  7848. "_selector",
  7849. smalltalk.method({
  7850. selector: "selector",
  7851. category: 'accessing',
  7852. fn: function (){
  7853. var self=this;
  7854. return smalltalk.withContext(function($ctx1) { var $1;
  7855. $1=self["@selector"];
  7856. return $1;
  7857. }, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.Message)})},
  7858. args: [],
  7859. source: "selector\x0a\x09^selector",
  7860. messageSends: [],
  7861. referencedClasses: []
  7862. }),
  7863. smalltalk.Message);
  7864. smalltalk.addMethod(
  7865. "_selector_",
  7866. smalltalk.method({
  7867. selector: "selector:",
  7868. category: 'accessing',
  7869. fn: function (aString){
  7870. var self=this;
  7871. return smalltalk.withContext(function($ctx1) { self["@selector"]=aString;
  7872. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString}, smalltalk.Message)})},
  7873. args: ["aString"],
  7874. source: "selector: aString\x0a\x09selector := aString",
  7875. messageSends: [],
  7876. referencedClasses: []
  7877. }),
  7878. smalltalk.Message);
  7879. smalltalk.addMethod(
  7880. "_sendTo_",
  7881. smalltalk.method({
  7882. selector: "sendTo:",
  7883. category: 'printing',
  7884. fn: function (anObject){
  7885. var self=this;
  7886. return smalltalk.withContext(function($ctx1) { var $1;
  7887. $1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments());
  7888. return $1;
  7889. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject}, smalltalk.Message)})},
  7890. args: ["anObject"],
  7891. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  7892. messageSends: ["perform:withArguments:", "selector", "arguments"],
  7893. referencedClasses: []
  7894. }),
  7895. smalltalk.Message);
  7896. smalltalk.addMethod(
  7897. "_selector_arguments_",
  7898. smalltalk.method({
  7899. selector: "selector:arguments:",
  7900. category: 'instance creation',
  7901. fn: function (aString,anArray){
  7902. var self=this;
  7903. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  7904. $2=_st(self)._new();
  7905. _st($2)._selector_(aString);
  7906. _st($2)._arguments_(anArray);
  7907. $3=_st($2)._yourself();
  7908. $1=$3;
  7909. return $1;
  7910. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray}, smalltalk.Message.klass)})},
  7911. args: ["aString", "anArray"],
  7912. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  7913. messageSends: ["selector:", "new", "arguments:", "yourself"],
  7914. referencedClasses: []
  7915. }),
  7916. smalltalk.Message.klass);
  7917. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  7918. smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a \x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js"
  7919. smalltalk.addMethod(
  7920. "_asString",
  7921. smalltalk.method({
  7922. selector: "asString",
  7923. category: 'converting',
  7924. fn: function (){
  7925. var self=this;
  7926. return smalltalk.withContext(function($ctx1) { var $2,$1;
  7927. $2=_st(self)._isBlockContext();
  7928. if(smalltalk.assert($2)){
  7929. $1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")");
  7930. } else {
  7931. $1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
  7932. };
  7933. return $1;
  7934. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.MethodContext)})},
  7935. args: [],
  7936. source: "asString\x0a\x09^self isBlockContext \x0a \x09ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]\x0a \x09ifFalse: [ self receiver class printString, ' >> ', self selector ]",
  7937. messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"],
  7938. referencedClasses: []
  7939. }),
  7940. smalltalk.MethodContext);
  7941. smalltalk.addMethod(
  7942. "_home",
  7943. smalltalk.method({
  7944. selector: "home",
  7945. category: 'accessing',
  7946. fn: function (){
  7947. var self=this;
  7948. return smalltalk.withContext(function($ctx1) { return self.methodContext || self.homeContext;
  7949. return self}, function($ctx1) {$ctx1.fill(self,"home",{}, smalltalk.MethodContext)})},
  7950. args: [],
  7951. source: "home\x0a\x09<return self.methodContext || self.homeContext>",
  7952. messageSends: [],
  7953. referencedClasses: []
  7954. }),
  7955. smalltalk.MethodContext);
  7956. smalltalk.addMethod(
  7957. "_isBlockContext",
  7958. smalltalk.method({
  7959. selector: "isBlockContext",
  7960. category: 'testing',
  7961. fn: function (){
  7962. var self=this;
  7963. return smalltalk.withContext(function($ctx1) { var $1;
  7964. $1=_st(_st(self)._selector())._isNil();
  7965. return $1;
  7966. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{}, smalltalk.MethodContext)})},
  7967. args: [],
  7968. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a \x0a\x09^ self selector isNil",
  7969. messageSends: ["isNil", "selector"],
  7970. referencedClasses: []
  7971. }),
  7972. smalltalk.MethodContext);
  7973. smalltalk.addMethod(
  7974. "_locals",
  7975. smalltalk.method({
  7976. selector: "locals",
  7977. category: 'accessing',
  7978. fn: function (){
  7979. var self=this;
  7980. return smalltalk.withContext(function($ctx1) { return self.locals;
  7981. return self}, function($ctx1) {$ctx1.fill(self,"locals",{}, smalltalk.MethodContext)})},
  7982. args: [],
  7983. source: "locals\x0a\x09<return self.locals>",
  7984. messageSends: [],
  7985. referencedClasses: []
  7986. }),
  7987. smalltalk.MethodContext);
  7988. smalltalk.addMethod(
  7989. "_method",
  7990. smalltalk.method({
  7991. selector: "method",
  7992. category: 'accessing',
  7993. fn: function (){
  7994. var self=this;
  7995. return smalltalk.withContext(function($ctx1) { var $1;
  7996. $1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector());
  7997. return $1;
  7998. }, function($ctx1) {$ctx1.fill(self,"method",{}, smalltalk.MethodContext)})},
  7999. args: [],
  8000. source: "method\x0a\x09^self methodContext receiver class lookupSelector: self methodContext selector",
  8001. messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"],
  8002. referencedClasses: []
  8003. }),
  8004. smalltalk.MethodContext);
  8005. smalltalk.addMethod(
  8006. "_methodContext",
  8007. smalltalk.method({
  8008. selector: "methodContext",
  8009. category: 'accessing',
  8010. fn: function (){
  8011. var self=this;
  8012. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  8013. $1=_st(self)._isBlockContext();
  8014. if(! smalltalk.assert($1)){
  8015. $2=self;
  8016. return $2;
  8017. };
  8018. $3=_st(self)._home();
  8019. return $3;
  8020. }, function($ctx1) {$ctx1.fill(self,"methodContext",{}, smalltalk.MethodContext)})},
  8021. args: [],
  8022. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a \x0a ^ self home",
  8023. messageSends: ["ifFalse:", "isBlockContext", "home"],
  8024. referencedClasses: []
  8025. }),
  8026. smalltalk.MethodContext);
  8027. smalltalk.addMethod(
  8028. "_outerContext",
  8029. smalltalk.method({
  8030. selector: "outerContext",
  8031. category: 'accessing',
  8032. fn: function (){
  8033. var self=this;
  8034. return smalltalk.withContext(function($ctx1) { return self.homeContext;
  8035. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{}, smalltalk.MethodContext)})},
  8036. args: [],
  8037. source: "outerContext\x0a\x09<return self.homeContext>",
  8038. messageSends: [],
  8039. referencedClasses: []
  8040. }),
  8041. smalltalk.MethodContext);
  8042. smalltalk.addMethod(
  8043. "_pc",
  8044. smalltalk.method({
  8045. selector: "pc",
  8046. category: 'accessing',
  8047. fn: function (){
  8048. var self=this;
  8049. return smalltalk.withContext(function($ctx1) { return self.pc;
  8050. return self}, function($ctx1) {$ctx1.fill(self,"pc",{}, smalltalk.MethodContext)})},
  8051. args: [],
  8052. source: "pc\x0a\x09<return self.pc>",
  8053. messageSends: [],
  8054. referencedClasses: []
  8055. }),
  8056. smalltalk.MethodContext);
  8057. smalltalk.addMethod(
  8058. "_printString",
  8059. smalltalk.method({
  8060. selector: "printString",
  8061. category: 'accessing',
  8062. fn: function (){
  8063. var self=this;
  8064. return smalltalk.withContext(function($ctx1) { var $1;
  8065. $1=_st(_st(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma("(")).__comma(_st(self)._asString())).__comma(")");
  8066. return $1;
  8067. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.MethodContext)})},
  8068. args: [],
  8069. source: "printString\x0a\x09^super printString, '(', self asString, ')'",
  8070. messageSends: [",", "asString", "printString"],
  8071. referencedClasses: []
  8072. }),
  8073. smalltalk.MethodContext);
  8074. smalltalk.addMethod(
  8075. "_receiver",
  8076. smalltalk.method({
  8077. selector: "receiver",
  8078. category: 'accessing',
  8079. fn: function (){
  8080. var self=this;
  8081. return smalltalk.withContext(function($ctx1) { return self.receiver;
  8082. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.MethodContext)})},
  8083. args: [],
  8084. source: "receiver\x0a\x09<return self.receiver>",
  8085. messageSends: [],
  8086. referencedClasses: []
  8087. }),
  8088. smalltalk.MethodContext);
  8089. smalltalk.addMethod(
  8090. "_selector",
  8091. smalltalk.method({
  8092. selector: "selector",
  8093. category: 'accessing',
  8094. fn: function (){
  8095. var self=this;
  8096. return smalltalk.withContext(function($ctx1) {
  8097. if(self.selector) {
  8098. return smalltalk.convertSelector(self.selector);
  8099. } else {
  8100. return nil;
  8101. }
  8102. ;
  8103. return self}, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.MethodContext)})},
  8104. args: [],
  8105. source: "selector\x0a\x09<\x0a \x09if(self.selector) {\x0a \x09return smalltalk.convertSelector(self.selector);\x0a } else {\x0a \x09return nil;\x0a }\x0a >",
  8106. messageSends: [],
  8107. referencedClasses: []
  8108. }),
  8109. smalltalk.MethodContext);
  8110. smalltalk.addMethod(
  8111. "_temps",
  8112. smalltalk.method({
  8113. selector: "temps",
  8114. category: 'accessing',
  8115. fn: function (){
  8116. var self=this;
  8117. return smalltalk.withContext(function($ctx1) { var $1;
  8118. _st(self)._deprecatedAPI();
  8119. $1=_st(self)._locals();
  8120. return $1;
  8121. }, function($ctx1) {$ctx1.fill(self,"temps",{}, smalltalk.MethodContext)})},
  8122. args: [],
  8123. source: "temps\x0a\x09self deprecatedAPI.\x0a \x0a\x09^ self locals",
  8124. messageSends: ["deprecatedAPI", "locals"],
  8125. referencedClasses: []
  8126. }),
  8127. smalltalk.MethodContext);
  8128. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  8129. smalltalk.NativeFunction.comment="NativeFunction is a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0aSee the class-side `instance creation` methods.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0aUsage example:\x0a\x0a | ws |\x0a ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]"
  8130. smalltalk.addMethod(
  8131. "_constructor_",
  8132. smalltalk.method({
  8133. selector: "constructor:",
  8134. category: 'instance creation',
  8135. fn: function (aString){
  8136. var self=this;
  8137. return smalltalk.withContext(function($ctx1) {
  8138. var native=eval(aString);
  8139. return new native();
  8140. ;
  8141. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString}, smalltalk.NativeFunction.klass)})},
  8142. args: ["aString"],
  8143. source: "constructor: aString\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native();\x0a\x09>",
  8144. messageSends: [],
  8145. referencedClasses: []
  8146. }),
  8147. smalltalk.NativeFunction.klass);
  8148. smalltalk.addMethod(
  8149. "_constructor_value_",
  8150. smalltalk.method({
  8151. selector: "constructor:value:",
  8152. category: 'instance creation',
  8153. fn: function (aString,anObject){
  8154. var self=this;
  8155. return smalltalk.withContext(function($ctx1) {
  8156. var native=eval(aString);
  8157. return new native(anObject);
  8158. ;
  8159. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject}, smalltalk.NativeFunction.klass)})},
  8160. args: ["aString", "anObject"],
  8161. source: "constructor: aString value:anObject\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native(anObject);\x0a\x09>",
  8162. messageSends: [],
  8163. referencedClasses: []
  8164. }),
  8165. smalltalk.NativeFunction.klass);
  8166. smalltalk.addMethod(
  8167. "_constructor_value_value_",
  8168. smalltalk.method({
  8169. selector: "constructor:value:value:",
  8170. category: 'instance creation',
  8171. fn: function (aString,anObject,anObject2){
  8172. var self=this;
  8173. return smalltalk.withContext(function($ctx1) {
  8174. var native=eval(aString);
  8175. return new native(anObject,anObject2);
  8176. ;
  8177. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2}, smalltalk.NativeFunction.klass)})},
  8178. args: ["aString", "anObject", "anObject2"],
  8179. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native(anObject,anObject2);\x0a\x09>",
  8180. messageSends: [],
  8181. referencedClasses: []
  8182. }),
  8183. smalltalk.NativeFunction.klass);
  8184. smalltalk.addMethod(
  8185. "_constructor_value_value_value_",
  8186. smalltalk.method({
  8187. selector: "constructor:value:value:value:",
  8188. category: 'instance creation',
  8189. fn: function (aString,anObject,anObject2,anObject3){
  8190. var self=this;
  8191. return smalltalk.withContext(function($ctx1) {
  8192. var native=eval(aString);
  8193. return new native(anObject,anObject2, anObject3);
  8194. ;
  8195. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.NativeFunction.klass)})},
  8196. args: ["aString", "anObject", "anObject2", "anObject3"],
  8197. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native(anObject,anObject2, anObject3);\x0a\x09>",
  8198. messageSends: [],
  8199. referencedClasses: []
  8200. }),
  8201. smalltalk.NativeFunction.klass);
  8202. smalltalk.addMethod(
  8203. "_exists_",
  8204. smalltalk.method({
  8205. selector: "exists:",
  8206. category: 'testing',
  8207. fn: function (aString){
  8208. var self=this;
  8209. return smalltalk.withContext(function($ctx1) {
  8210. if(aString in window) {
  8211. return true
  8212. } else {
  8213. return false
  8214. }
  8215. ;
  8216. return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString}, smalltalk.NativeFunction.klass)})},
  8217. args: ["aString"],
  8218. source: "exists: aString\x0a\x09<\x0a \x09if(aString in window) {\x0a \x09return true\x0a } else {\x0a \x09return false\x0a }\x0a >",
  8219. messageSends: [],
  8220. referencedClasses: []
  8221. }),
  8222. smalltalk.NativeFunction.klass);
  8223. smalltalk.addPackage('Kernel-Collections', {});
  8224. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  8225. smalltalk.addMethod(
  8226. "__eq",
  8227. smalltalk.method({
  8228. selector: "=",
  8229. category: 'comparing',
  8230. fn: function (anAssociation){
  8231. var self=this;
  8232. return smalltalk.withContext(function($ctx1) { var $1;
  8233. $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  8234. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  8235. return smalltalk.withContext(function($ctx3) { return _st(_st(self)._value()).__eq(_st(anAssociation)._value());
  8236. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  8237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8238. return $1;
  8239. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation}, smalltalk.Association)})},
  8240. args: ["anAssociation"],
  8241. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09 self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  8242. messageSends: ["and:", "=", "value", "key", "class"],
  8243. referencedClasses: []
  8244. }),
  8245. smalltalk.Association);
  8246. smalltalk.addMethod(
  8247. "_key",
  8248. smalltalk.method({
  8249. selector: "key",
  8250. category: 'accessing',
  8251. fn: function (){
  8252. var self=this;
  8253. return smalltalk.withContext(function($ctx1) { var $1;
  8254. $1=self["@key"];
  8255. return $1;
  8256. }, function($ctx1) {$ctx1.fill(self,"key",{}, smalltalk.Association)})},
  8257. args: [],
  8258. source: "key\x0a\x09^key",
  8259. messageSends: [],
  8260. referencedClasses: []
  8261. }),
  8262. smalltalk.Association);
  8263. smalltalk.addMethod(
  8264. "_key_",
  8265. smalltalk.method({
  8266. selector: "key:",
  8267. category: 'accessing',
  8268. fn: function (aKey){
  8269. var self=this;
  8270. return smalltalk.withContext(function($ctx1) { self["@key"]=aKey;
  8271. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey}, smalltalk.Association)})},
  8272. args: ["aKey"],
  8273. source: "key: aKey\x0a\x09key := aKey",
  8274. messageSends: [],
  8275. referencedClasses: []
  8276. }),
  8277. smalltalk.Association);
  8278. smalltalk.addMethod(
  8279. "_printString",
  8280. smalltalk.method({
  8281. selector: "printString",
  8282. category: 'printing',
  8283. fn: function (){
  8284. var self=this;
  8285. return smalltalk.withContext(function($ctx1) { var $1;
  8286. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  8287. return smalltalk.withContext(function($ctx2) { return _st(self)._storeOn_(aStream);
  8288. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  8289. return $1;
  8290. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Association)})},
  8291. args: [],
  8292. source: "printString\x0a\x09\x22print the contents of the Association into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09self storeOn: aStream]",
  8293. messageSends: ["streamContents:", "storeOn:"],
  8294. referencedClasses: ["String"]
  8295. }),
  8296. smalltalk.Association);
  8297. smalltalk.addMethod(
  8298. "_storeOn_",
  8299. smalltalk.method({
  8300. selector: "storeOn:",
  8301. category: 'printing',
  8302. fn: function (aStream){
  8303. var self=this;
  8304. return smalltalk.withContext(function($ctx1) { _st(self["@key"])._storeOn_(aStream);
  8305. _st(aStream)._nextPutAll_("->");
  8306. _st(self["@value"])._storeOn_(aStream);
  8307. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.Association)})},
  8308. args: ["aStream"],
  8309. source: "storeOn: aStream\x0a\x09\x22Store in the format: key->value\x22\x0a\x0a\x09key storeOn: aStream.\x0a\x09aStream nextPutAll: '->'.\x0a\x09value storeOn: aStream.",
  8310. messageSends: ["storeOn:", "nextPutAll:"],
  8311. referencedClasses: []
  8312. }),
  8313. smalltalk.Association);
  8314. smalltalk.addMethod(
  8315. "_value",
  8316. smalltalk.method({
  8317. selector: "value",
  8318. category: 'accessing',
  8319. fn: function (){
  8320. var self=this;
  8321. return smalltalk.withContext(function($ctx1) { var $1;
  8322. $1=self["@value"];
  8323. return $1;
  8324. }, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.Association)})},
  8325. args: [],
  8326. source: "value\x0a\x09^value",
  8327. messageSends: [],
  8328. referencedClasses: []
  8329. }),
  8330. smalltalk.Association);
  8331. smalltalk.addMethod(
  8332. "_value_",
  8333. smalltalk.method({
  8334. selector: "value:",
  8335. category: 'accessing',
  8336. fn: function (aValue){
  8337. var self=this;
  8338. return smalltalk.withContext(function($ctx1) { self["@value"]=aValue;
  8339. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue}, smalltalk.Association)})},
  8340. args: ["aValue"],
  8341. source: "value: aValue\x0a\x09value := aValue",
  8342. messageSends: [],
  8343. referencedClasses: []
  8344. }),
  8345. smalltalk.Association);
  8346. smalltalk.addMethod(
  8347. "_key_value_",
  8348. smalltalk.method({
  8349. selector: "key:value:",
  8350. category: 'instance creation',
  8351. fn: function (aKey,aValue){
  8352. var self=this;
  8353. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  8354. $2=_st(self)._new();
  8355. _st($2)._key_(aKey);
  8356. _st($2)._value_(aValue);
  8357. $3=_st($2)._yourself();
  8358. $1=$3;
  8359. return $1;
  8360. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue}, smalltalk.Association.klass)})},
  8361. args: ["aKey", "aValue"],
  8362. source: "key: aKey value: aValue\x0a\x09 ^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  8363. messageSends: ["key:", "new", "value:", "yourself"],
  8364. referencedClasses: []
  8365. }),
  8366. smalltalk.Association.klass);
  8367. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  8368. smalltalk.addMethod(
  8369. "__comma",
  8370. smalltalk.method({
  8371. selector: ",",
  8372. category: 'copying',
  8373. fn: function (aCollection){
  8374. var self=this;
  8375. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  8376. $2=_st(self)._copy();
  8377. _st($2)._addAll_(aCollection);
  8378. $3=_st($2)._yourself();
  8379. $1=$3;
  8380. return $1;
  8381. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.Collection)})},
  8382. args: ["aCollection"],
  8383. source: ", aCollection\x0a\x09^self copy \x0a\x09 addAll: aCollection; \x0a\x09 yourself",
  8384. messageSends: ["addAll:", "copy", "yourself"],
  8385. referencedClasses: []
  8386. }),
  8387. smalltalk.Collection);
  8388. smalltalk.addMethod(
  8389. "_add_",
  8390. smalltalk.method({
  8391. selector: "add:",
  8392. category: 'adding/removing',
  8393. fn: function (anObject){
  8394. var self=this;
  8395. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  8396. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Collection)})},
  8397. args: ["anObject"],
  8398. source: "add: anObject\x0a\x09self subclassResponsibility",
  8399. messageSends: ["subclassResponsibility"],
  8400. referencedClasses: []
  8401. }),
  8402. smalltalk.Collection);
  8403. smalltalk.addMethod(
  8404. "_addAll_",
  8405. smalltalk.method({
  8406. selector: "addAll:",
  8407. category: 'adding/removing',
  8408. fn: function (aCollection){
  8409. var self=this;
  8410. return smalltalk.withContext(function($ctx1) { var $1;
  8411. _st(aCollection)._do_((function(each){
  8412. return smalltalk.withContext(function($ctx2) { return _st(self)._add_(each);
  8413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8414. $1=aCollection;
  8415. return $1;
  8416. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection}, smalltalk.Collection)})},
  8417. args: ["aCollection"],
  8418. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self add: each].\x0a\x09^aCollection",
  8419. messageSends: ["do:", "add:"],
  8420. referencedClasses: []
  8421. }),
  8422. smalltalk.Collection);
  8423. smalltalk.addMethod(
  8424. "_asArray",
  8425. smalltalk.method({
  8426. selector: "asArray",
  8427. category: 'converting',
  8428. fn: function (){
  8429. var self=this;
  8430. return smalltalk.withContext(function($ctx1) { var $1;
  8431. $1=_st((smalltalk.Array || Array))._withAll_(self);
  8432. return $1;
  8433. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Collection)})},
  8434. args: [],
  8435. source: "asArray\x0a\x09^Array withAll: self",
  8436. messageSends: ["withAll:"],
  8437. referencedClasses: ["Array"]
  8438. }),
  8439. smalltalk.Collection);
  8440. smalltalk.addMethod(
  8441. "_asJSON",
  8442. smalltalk.method({
  8443. selector: "asJSON",
  8444. category: 'converting',
  8445. fn: function (){
  8446. var self=this;
  8447. return smalltalk.withContext(function($ctx1) { var $1;
  8448. $1=_st(_st(self)._asArray())._collect_((function(each){
  8449. return smalltalk.withContext(function($ctx2) { return _st(each)._asJSON();
  8450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8451. return $1;
  8452. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Collection)})},
  8453. args: [],
  8454. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  8455. messageSends: ["collect:", "asJSON", "asArray"],
  8456. referencedClasses: []
  8457. }),
  8458. smalltalk.Collection);
  8459. smalltalk.addMethod(
  8460. "_asOrderedCollection",
  8461. smalltalk.method({
  8462. selector: "asOrderedCollection",
  8463. category: 'converting',
  8464. fn: function (){
  8465. var self=this;
  8466. return smalltalk.withContext(function($ctx1) { var $1;
  8467. $1=_st(self)._asArray();
  8468. return $1;
  8469. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{}, smalltalk.Collection)})},
  8470. args: [],
  8471. source: "asOrderedCollection\x0a\x09^self asArray",
  8472. messageSends: ["asArray"],
  8473. referencedClasses: []
  8474. }),
  8475. smalltalk.Collection);
  8476. smalltalk.addMethod(
  8477. "_asSet",
  8478. smalltalk.method({
  8479. selector: "asSet",
  8480. category: 'converting',
  8481. fn: function (){
  8482. var self=this;
  8483. return smalltalk.withContext(function($ctx1) { var $1;
  8484. $1=_st((smalltalk.Set || Set))._withAll_(self);
  8485. return $1;
  8486. }, function($ctx1) {$ctx1.fill(self,"asSet",{}, smalltalk.Collection)})},
  8487. args: [],
  8488. source: "asSet\x0a\x09^Set withAll: self",
  8489. messageSends: ["withAll:"],
  8490. referencedClasses: ["Set"]
  8491. }),
  8492. smalltalk.Collection);
  8493. smalltalk.addMethod(
  8494. "_collect_",
  8495. smalltalk.method({
  8496. selector: "collect:",
  8497. category: 'enumerating',
  8498. fn: function (aBlock){
  8499. var self=this;
  8500. var stream;
  8501. return smalltalk.withContext(function($ctx1) { var $1;
  8502. stream=_st(_st(_st(self)._class())._new())._writeStream();
  8503. _st(self)._do_((function(each){
  8504. return smalltalk.withContext(function($ctx2) { return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  8505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8506. $1=_st(stream)._contents();
  8507. return $1;
  8508. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)})},
  8509. args: ["aBlock"],
  8510. 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",
  8511. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  8512. referencedClasses: []
  8513. }),
  8514. smalltalk.Collection);
  8515. smalltalk.addMethod(
  8516. "_copyWith_",
  8517. smalltalk.method({
  8518. selector: "copyWith:",
  8519. category: 'copying',
  8520. fn: function (anObject){
  8521. var self=this;
  8522. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  8523. $2=_st(self)._copy();
  8524. _st($2)._add_(anObject);
  8525. $3=_st($2)._yourself();
  8526. $1=$3;
  8527. return $1;
  8528. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject}, smalltalk.Collection)})},
  8529. args: ["anObject"],
  8530. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  8531. messageSends: ["add:", "copy", "yourself"],
  8532. referencedClasses: []
  8533. }),
  8534. smalltalk.Collection);
  8535. smalltalk.addMethod(
  8536. "_copyWithAll_",
  8537. smalltalk.method({
  8538. selector: "copyWithAll:",
  8539. category: 'copying',
  8540. fn: function (aCollection){
  8541. var self=this;
  8542. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  8543. $2=_st(self)._copy();
  8544. _st($2)._addAll_(aCollection);
  8545. $3=_st($2)._yourself();
  8546. $1=$3;
  8547. return $1;
  8548. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection}, smalltalk.Collection)})},
  8549. args: ["aCollection"],
  8550. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  8551. messageSends: ["addAll:", "copy", "yourself"],
  8552. referencedClasses: []
  8553. }),
  8554. smalltalk.Collection);
  8555. smalltalk.addMethod(
  8556. "_copyWithoutAll_",
  8557. smalltalk.method({
  8558. selector: "copyWithoutAll:",
  8559. category: 'copying',
  8560. fn: function (aCollection){
  8561. var self=this;
  8562. return smalltalk.withContext(function($ctx1) { var $1;
  8563. $1=_st(self)._reject_((function(each){
  8564. return smalltalk.withContext(function($ctx2) { return _st(aCollection)._includes_(each);
  8565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8566. return $1;
  8567. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection}, smalltalk.Collection)})},
  8568. args: ["aCollection"],
  8569. 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]",
  8570. messageSends: ["reject:", "includes:"],
  8571. referencedClasses: []
  8572. }),
  8573. smalltalk.Collection);
  8574. smalltalk.addMethod(
  8575. "_detect_",
  8576. smalltalk.method({
  8577. selector: "detect:",
  8578. category: 'enumerating',
  8579. fn: function (aBlock){
  8580. var self=this;
  8581. return smalltalk.withContext(function($ctx1) { var $1;
  8582. $1=_st(self)._detect_ifNone_(aBlock,(function(){
  8583. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  8584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8585. return $1;
  8586. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Collection)})},
  8587. args: ["aBlock"],
  8588. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  8589. messageSends: ["detect:ifNone:", "errorNotFound"],
  8590. referencedClasses: []
  8591. }),
  8592. smalltalk.Collection);
  8593. smalltalk.addMethod(
  8594. "_detect_ifNone_",
  8595. smalltalk.method({
  8596. selector: "detect:ifNone:",
  8597. category: 'enumerating',
  8598. fn: function (aBlock,anotherBlock){
  8599. var self=this;
  8600. return smalltalk.withContext(function($ctx1) {
  8601. for(var i = 0; i < self.length; i++)
  8602. if(aBlock(self[i]))
  8603. return self[i];
  8604. return anotherBlock();
  8605. ;
  8606. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Collection)})},
  8607. args: ["aBlock", "anotherBlock"],
  8608. 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>",
  8609. messageSends: [],
  8610. referencedClasses: []
  8611. }),
  8612. smalltalk.Collection);
  8613. smalltalk.addMethod(
  8614. "_do_",
  8615. smalltalk.method({
  8616. selector: "do:",
  8617. category: 'enumerating',
  8618. fn: function (aBlock){
  8619. var self=this;
  8620. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i]);};
  8621. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Collection)})},
  8622. args: ["aBlock"],
  8623. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  8624. messageSends: [],
  8625. referencedClasses: []
  8626. }),
  8627. smalltalk.Collection);
  8628. smalltalk.addMethod(
  8629. "_do_separatedBy_",
  8630. smalltalk.method({
  8631. selector: "do:separatedBy:",
  8632. category: 'enumerating',
  8633. fn: function (aBlock,anotherBlock){
  8634. var self=this;
  8635. var first;
  8636. return smalltalk.withContext(function($ctx1) { var $1;
  8637. first=true;
  8638. _st(self)._do_((function(each){
  8639. return smalltalk.withContext(function($ctx2) { $1=first;
  8640. if(smalltalk.assert($1)){
  8641. first=false;
  8642. first;
  8643. } else {
  8644. _st(anotherBlock)._value();
  8645. };
  8646. return _st(aBlock)._value_(each);
  8647. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8648. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,first:first}, smalltalk.Collection)})},
  8649. args: ["aBlock", "anotherBlock"],
  8650. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| first |\x0a\x09first := true.\x0a\x09self do: [:each |\x0a\x09 first\x0a\x09\x09ifTrue: [first := false]\x0a\x09\x09ifFalse: [anotherBlock value].\x0a\x09 aBlock value: each]",
  8651. messageSends: ["do:", "ifTrue:ifFalse:", "value", "value:"],
  8652. referencedClasses: []
  8653. }),
  8654. smalltalk.Collection);
  8655. smalltalk.addMethod(
  8656. "_errorNotFound",
  8657. smalltalk.method({
  8658. selector: "errorNotFound",
  8659. category: 'error handling',
  8660. fn: function (){
  8661. var self=this;
  8662. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is not in the collection");
  8663. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{}, smalltalk.Collection)})},
  8664. args: [],
  8665. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  8666. messageSends: ["error:"],
  8667. referencedClasses: []
  8668. }),
  8669. smalltalk.Collection);
  8670. smalltalk.addMethod(
  8671. "_ifEmpty_",
  8672. smalltalk.method({
  8673. selector: "ifEmpty:",
  8674. category: 'testing',
  8675. fn: function (aBlock){
  8676. var self=this;
  8677. return smalltalk.withContext(function($ctx1) { var $2,$1;
  8678. $2=_st(self)._isEmpty();
  8679. if(smalltalk.assert($2)){
  8680. $1=_st(aBlock)._value();
  8681. } else {
  8682. $1=self;
  8683. };
  8684. return $1;
  8685. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock}, smalltalk.Collection)})},
  8686. args: ["aBlock"],
  8687. 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 ]",
  8688. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  8689. referencedClasses: []
  8690. }),
  8691. smalltalk.Collection);
  8692. smalltalk.addMethod(
  8693. "_ifNotEmpty_",
  8694. smalltalk.method({
  8695. selector: "ifNotEmpty:",
  8696. category: 'testing',
  8697. fn: function (aBlock){
  8698. var self=this;
  8699. return smalltalk.withContext(function($ctx1) { var $1;
  8700. $1=_st(self)._notEmpty();
  8701. _st($1)._ifTrue_(aBlock);
  8702. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock}, smalltalk.Collection)})},
  8703. args: ["aBlock"],
  8704. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  8705. messageSends: ["ifTrue:", "notEmpty"],
  8706. referencedClasses: []
  8707. }),
  8708. smalltalk.Collection);
  8709. smalltalk.addMethod(
  8710. "_includes_",
  8711. smalltalk.method({
  8712. selector: "includes:",
  8713. category: 'testing',
  8714. fn: function (anObject){
  8715. var self=this;
  8716. var sentinel;
  8717. return smalltalk.withContext(function($ctx1) { var $1;
  8718. sentinel=_st((smalltalk.Object || Object))._new();
  8719. $1=_st(_st(self)._detect_ifNone_((function(each){
  8720. return smalltalk.withContext(function($ctx2) { return _st(each).__eq(anObject);
  8721. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  8722. return smalltalk.withContext(function($ctx2) { return sentinel;
  8723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel);
  8724. return $1;
  8725. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel}, smalltalk.Collection)})},
  8726. args: ["anObject"],
  8727. source: "includes: anObject\x0a\x09| sentinel |\x0a sentinel := Object new.\x0a ^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
  8728. messageSends: ["new", "~=", "detect:ifNone:", "="],
  8729. referencedClasses: ["Object"]
  8730. }),
  8731. smalltalk.Collection);
  8732. smalltalk.addMethod(
  8733. "_inject_into_",
  8734. smalltalk.method({
  8735. selector: "inject:into:",
  8736. category: 'enumerating',
  8737. fn: function (anObject,aBlock){
  8738. var self=this;
  8739. var result;
  8740. return smalltalk.withContext(function($ctx1) { var $1;
  8741. result=anObject;
  8742. _st(self)._do_((function(each){
  8743. return smalltalk.withContext(function($ctx2) { result=_st(aBlock)._value_value_(result,each);
  8744. return result;
  8745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8746. $1=result;
  8747. return $1;
  8748. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result}, smalltalk.Collection)})},
  8749. args: ["anObject", "aBlock"],
  8750. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [:each | \x0a\x09 result := aBlock value: result value: each].\x0a\x09^result",
  8751. messageSends: ["do:", "value:value:"],
  8752. referencedClasses: []
  8753. }),
  8754. smalltalk.Collection);
  8755. smalltalk.addMethod(
  8756. "_intersection_",
  8757. smalltalk.method({
  8758. selector: "intersection:",
  8759. category: 'enumerating',
  8760. fn: function (aCollection){
  8761. var self=this;
  8762. var set,outputSet;
  8763. return smalltalk.withContext(function($ctx1) { var $1,$2;
  8764. set=_st(self)._asSet();
  8765. outputSet=_st((smalltalk.Set || Set))._new();
  8766. _st(aCollection)._do_((function(each){
  8767. return smalltalk.withContext(function($ctx2) { $1=_st(_st(set)._includes_(each))._and_((function(){
  8768. return smalltalk.withContext(function($ctx3) { return _st(_st(outputSet)._includes_(each))._not();
  8769. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  8770. if(smalltalk.assert($1)){
  8771. return _st(outputSet)._add_(each);
  8772. };
  8773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8774. $2=_st(_st(self)._class())._withAll_(_st(outputSet)._asArray());
  8775. return $2;
  8776. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet}, smalltalk.Collection)})},
  8777. args: ["aCollection"],
  8778. 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",
  8779. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  8780. referencedClasses: ["Set"]
  8781. }),
  8782. smalltalk.Collection);
  8783. smalltalk.addMethod(
  8784. "_isEmpty",
  8785. smalltalk.method({
  8786. selector: "isEmpty",
  8787. category: 'testing',
  8788. fn: function (){
  8789. var self=this;
  8790. return smalltalk.withContext(function($ctx1) { var $1;
  8791. $1=_st(_st(self)._size()).__eq((0));
  8792. return $1;
  8793. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Collection)})},
  8794. args: [],
  8795. source: "isEmpty\x0a\x09^self size = 0",
  8796. messageSends: ["=", "size"],
  8797. referencedClasses: []
  8798. }),
  8799. smalltalk.Collection);
  8800. smalltalk.addMethod(
  8801. "_notEmpty",
  8802. smalltalk.method({
  8803. selector: "notEmpty",
  8804. category: 'testing',
  8805. fn: function (){
  8806. var self=this;
  8807. return smalltalk.withContext(function($ctx1) { var $1;
  8808. $1=_st(_st(self)._isEmpty())._not();
  8809. return $1;
  8810. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{}, smalltalk.Collection)})},
  8811. args: [],
  8812. source: "notEmpty\x0a\x09^self isEmpty not",
  8813. messageSends: ["not", "isEmpty"],
  8814. referencedClasses: []
  8815. }),
  8816. smalltalk.Collection);
  8817. smalltalk.addMethod(
  8818. "_occurrencesOf_",
  8819. smalltalk.method({
  8820. selector: "occurrencesOf:",
  8821. category: 'accessing',
  8822. fn: function (anObject){
  8823. var self=this;
  8824. var tally;
  8825. return smalltalk.withContext(function($ctx1) { var $1,$2;
  8826. tally=(0);
  8827. _st(self)._do_((function(each){
  8828. return smalltalk.withContext(function($ctx2) { $1=_st(anObject).__eq(each);
  8829. if(smalltalk.assert($1)){
  8830. tally=_st(tally).__plus((1));
  8831. return tally;
  8832. };
  8833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8834. $2=tally;
  8835. return $2;
  8836. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally}, smalltalk.Collection)})},
  8837. args: ["anObject"],
  8838. 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",
  8839. messageSends: ["do:", "ifTrue:", "+", "="],
  8840. referencedClasses: []
  8841. }),
  8842. smalltalk.Collection);
  8843. smalltalk.addMethod(
  8844. "_printString",
  8845. smalltalk.method({
  8846. selector: "printString",
  8847. category: 'printing',
  8848. fn: function (){
  8849. var self=this;
  8850. return smalltalk.withContext(function($ctx1) { var $1;
  8851. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  8852. return smalltalk.withContext(function($ctx2) { _st(aStream)._nextPutAll_(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma(" ("));
  8853. _st(self)._do_separatedBy_((function(each){
  8854. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(_st(each)._printString());
  8855. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  8856. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(" ");
  8857. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  8858. return _st(aStream)._nextPutAll_(")");
  8859. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  8860. return $1;
  8861. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Collection)})},
  8862. args: [],
  8863. source: "printString\x0a\x09\x22print the contents of the Collection into a string and return it\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: super printString, ' ('.\x0a\x09\x09self do: [:each | aStream nextPutAll: each printString]\x0a\x09\x09\x09separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream nextPutAll: ')']",
  8864. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "do:separatedBy:"],
  8865. referencedClasses: ["String"]
  8866. }),
  8867. smalltalk.Collection);
  8868. smalltalk.addMethod(
  8869. "_readStream",
  8870. smalltalk.method({
  8871. selector: "readStream",
  8872. category: 'accessing',
  8873. fn: function (){
  8874. var self=this;
  8875. return smalltalk.withContext(function($ctx1) { var $1;
  8876. $1=_st(self)._stream();
  8877. return $1;
  8878. }, function($ctx1) {$ctx1.fill(self,"readStream",{}, smalltalk.Collection)})},
  8879. args: [],
  8880. source: "readStream\x0a\x09^self stream",
  8881. messageSends: ["stream"],
  8882. referencedClasses: []
  8883. }),
  8884. smalltalk.Collection);
  8885. smalltalk.addMethod(
  8886. "_reject_",
  8887. smalltalk.method({
  8888. selector: "reject:",
  8889. category: 'enumerating',
  8890. fn: function (aBlock){
  8891. var self=this;
  8892. return smalltalk.withContext(function($ctx1) { var $1;
  8893. $1=_st(self)._select_((function(each){
  8894. return smalltalk.withContext(function($ctx2) { return _st(_st(aBlock)._value_(each)).__eq(false);
  8895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8896. return $1;
  8897. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock}, smalltalk.Collection)})},
  8898. args: ["aBlock"],
  8899. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  8900. messageSends: ["select:", "=", "value:"],
  8901. referencedClasses: []
  8902. }),
  8903. smalltalk.Collection);
  8904. smalltalk.addMethod(
  8905. "_remove_",
  8906. smalltalk.method({
  8907. selector: "remove:",
  8908. category: 'adding/removing',
  8909. fn: function (anObject){
  8910. var self=this;
  8911. return smalltalk.withContext(function($ctx1) { var $1;
  8912. $1=_st(self)._remove_ifAbsent_(anObject,(function(){
  8913. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  8914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8915. return $1;
  8916. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Collection)})},
  8917. args: ["anObject"],
  8918. source: "remove: anObject\x0a ^self remove: anObject ifAbsent: [self errorNotFound]",
  8919. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  8920. referencedClasses: []
  8921. }),
  8922. smalltalk.Collection);
  8923. smalltalk.addMethod(
  8924. "_remove_ifAbsent_",
  8925. smalltalk.method({
  8926. selector: "remove:ifAbsent:",
  8927. category: 'adding/removing',
  8928. fn: function (anObject,aBlock){
  8929. var self=this;
  8930. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  8931. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Collection)})},
  8932. args: ["anObject", "aBlock"],
  8933. source: "remove: anObject ifAbsent: aBlock\x0a self subclassResponsibility",
  8934. messageSends: ["subclassResponsibility"],
  8935. referencedClasses: []
  8936. }),
  8937. smalltalk.Collection);
  8938. smalltalk.addMethod(
  8939. "_select_",
  8940. smalltalk.method({
  8941. selector: "select:",
  8942. category: 'enumerating',
  8943. fn: function (aBlock){
  8944. var self=this;
  8945. var stream;
  8946. return smalltalk.withContext(function($ctx1) { var $1,$2;
  8947. stream=_st(_st(_st(self)._class())._new())._writeStream();
  8948. _st(self)._do_((function(each){
  8949. return smalltalk.withContext(function($ctx2) { $1=_st(aBlock)._value_(each);
  8950. if(smalltalk.assert($1)){
  8951. return _st(stream)._nextPut_(each);
  8952. };
  8953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8954. $2=_st(stream)._contents();
  8955. return $2;
  8956. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)})},
  8957. args: ["aBlock"],
  8958. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09 (aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each]].\x0a\x09^stream contents",
  8959. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  8960. referencedClasses: []
  8961. }),
  8962. smalltalk.Collection);
  8963. smalltalk.addMethod(
  8964. "_size",
  8965. smalltalk.method({
  8966. selector: "size",
  8967. category: 'accessing',
  8968. fn: function (){
  8969. var self=this;
  8970. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  8971. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Collection)})},
  8972. args: [],
  8973. source: "size\x0a\x09self subclassResponsibility",
  8974. messageSends: ["subclassResponsibility"],
  8975. referencedClasses: []
  8976. }),
  8977. smalltalk.Collection);
  8978. smalltalk.addMethod(
  8979. "_stream",
  8980. smalltalk.method({
  8981. selector: "stream",
  8982. category: 'accessing',
  8983. fn: function (){
  8984. var self=this;
  8985. return smalltalk.withContext(function($ctx1) { var $1;
  8986. $1=_st(_st(self)._streamClass())._on_(self);
  8987. return $1;
  8988. }, function($ctx1) {$ctx1.fill(self,"stream",{}, smalltalk.Collection)})},
  8989. args: [],
  8990. source: "stream\x0a\x09^self streamClass on: self",
  8991. messageSends: ["on:", "streamClass"],
  8992. referencedClasses: []
  8993. }),
  8994. smalltalk.Collection);
  8995. smalltalk.addMethod(
  8996. "_streamClass",
  8997. smalltalk.method({
  8998. selector: "streamClass",
  8999. category: 'accessing',
  9000. fn: function (){
  9001. var self=this;
  9002. return smalltalk.withContext(function($ctx1) { var $1;
  9003. $1=_st(_st(self)._class())._streamClass();
  9004. return $1;
  9005. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection)})},
  9006. args: [],
  9007. source: "streamClass\x0a\x09^self class streamClass",
  9008. messageSends: ["streamClass", "class"],
  9009. referencedClasses: []
  9010. }),
  9011. smalltalk.Collection);
  9012. smalltalk.addMethod(
  9013. "_writeStream",
  9014. smalltalk.method({
  9015. selector: "writeStream",
  9016. category: 'accessing',
  9017. fn: function (){
  9018. var self=this;
  9019. return smalltalk.withContext(function($ctx1) { var $1;
  9020. $1=_st(self)._stream();
  9021. return $1;
  9022. }, function($ctx1) {$ctx1.fill(self,"writeStream",{}, smalltalk.Collection)})},
  9023. args: [],
  9024. source: "writeStream\x0a\x09^self stream",
  9025. messageSends: ["stream"],
  9026. referencedClasses: []
  9027. }),
  9028. smalltalk.Collection);
  9029. smalltalk.addMethod(
  9030. "_new_",
  9031. smalltalk.method({
  9032. selector: "new:",
  9033. category: 'instance creation',
  9034. fn: function (anInteger){
  9035. var self=this;
  9036. return smalltalk.withContext(function($ctx1) { var $1;
  9037. $1=_st(self)._new();
  9038. return $1;
  9039. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Collection.klass)})},
  9040. args: ["anInteger"],
  9041. source: "new: anInteger\x0a\x09^self new",
  9042. messageSends: ["new"],
  9043. referencedClasses: []
  9044. }),
  9045. smalltalk.Collection.klass);
  9046. smalltalk.addMethod(
  9047. "_streamClass",
  9048. smalltalk.method({
  9049. selector: "streamClass",
  9050. category: 'accessing',
  9051. fn: function (){
  9052. var self=this;
  9053. return smalltalk.withContext(function($ctx1) { var $1;
  9054. $1=(smalltalk.Stream || Stream);
  9055. return $1;
  9056. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection.klass)})},
  9057. args: [],
  9058. source: "streamClass\x0a\x09 ^Stream",
  9059. messageSends: [],
  9060. referencedClasses: ["Stream"]
  9061. }),
  9062. smalltalk.Collection.klass);
  9063. smalltalk.addMethod(
  9064. "_with_",
  9065. smalltalk.method({
  9066. selector: "with:",
  9067. category: 'instance creation',
  9068. fn: function (anObject){
  9069. var self=this;
  9070. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  9071. $2=_st(self)._new();
  9072. _st($2)._add_(anObject);
  9073. $3=_st($2)._yourself();
  9074. $1=$3;
  9075. return $1;
  9076. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Collection.klass)})},
  9077. args: ["anObject"],
  9078. source: "with: anObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  9079. messageSends: ["add:", "new", "yourself"],
  9080. referencedClasses: []
  9081. }),
  9082. smalltalk.Collection.klass);
  9083. smalltalk.addMethod(
  9084. "_with_with_",
  9085. smalltalk.method({
  9086. selector: "with:with:",
  9087. category: 'instance creation',
  9088. fn: function (anObject,anotherObject){
  9089. var self=this;
  9090. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  9091. $2=_st(self)._new();
  9092. _st($2)._add_(anObject);
  9093. _st($2)._add_(anotherObject);
  9094. $3=_st($2)._yourself();
  9095. $1=$3;
  9096. return $1;
  9097. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject}, smalltalk.Collection.klass)})},
  9098. args: ["anObject", "anotherObject"],
  9099. source: "with: anObject with: anotherObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  9100. messageSends: ["add:", "new", "yourself"],
  9101. referencedClasses: []
  9102. }),
  9103. smalltalk.Collection.klass);
  9104. smalltalk.addMethod(
  9105. "_with_with_with_",
  9106. smalltalk.method({
  9107. selector: "with:with:with:",
  9108. category: 'instance creation',
  9109. fn: function (firstObject,secondObject,thirdObject){
  9110. var self=this;
  9111. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  9112. $2=_st(self)._new();
  9113. _st($2)._add_(firstObject);
  9114. _st($2)._add_(secondObject);
  9115. _st($2)._add_(thirdObject);
  9116. $3=_st($2)._yourself();
  9117. $1=$3;
  9118. return $1;
  9119. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject}, smalltalk.Collection.klass)})},
  9120. args: ["firstObject", "secondObject", "thirdObject"],
  9121. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09 ^self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  9122. messageSends: ["add:", "new", "yourself"],
  9123. referencedClasses: []
  9124. }),
  9125. smalltalk.Collection.klass);
  9126. smalltalk.addMethod(
  9127. "_withAll_",
  9128. smalltalk.method({
  9129. selector: "withAll:",
  9130. category: 'instance creation',
  9131. fn: function (aCollection){
  9132. var self=this;
  9133. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  9134. $2=_st(self)._new();
  9135. _st($2)._addAll_(aCollection);
  9136. $3=_st($2)._yourself();
  9137. $1=$3;
  9138. return $1;
  9139. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection}, smalltalk.Collection.klass)})},
  9140. args: ["aCollection"],
  9141. source: "withAll: aCollection\x0a\x09 ^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  9142. messageSends: ["addAll:", "new", "yourself"],
  9143. referencedClasses: []
  9144. }),
  9145. smalltalk.Collection.klass);
  9146. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  9147. smalltalk.HashedCollection.comment="A HashedCollection is a traditional JavaScript object, or a Smalltalk Dictionary.\x0a\x0aUnlike a Dictionary, it can only have strings as keys."
  9148. smalltalk.addMethod(
  9149. "__comma",
  9150. smalltalk.method({
  9151. selector: ",",
  9152. category: 'copying',
  9153. fn: function (aCollection){
  9154. var self=this;
  9155. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  9156. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.HashedCollection)})},
  9157. args: ["aCollection"],
  9158. source: ", aCollection\x0a\x09self shouldNotImplement",
  9159. messageSends: ["shouldNotImplement"],
  9160. referencedClasses: []
  9161. }),
  9162. smalltalk.HashedCollection);
  9163. smalltalk.addMethod(
  9164. "__eq",
  9165. smalltalk.method({
  9166. selector: "=",
  9167. category: 'comparing',
  9168. fn: function (aHashedCollection){
  9169. var self=this;
  9170. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  9171. $1=_st(_st(self)._class()).__eq(_st(aHashedCollection)._class());
  9172. if(! smalltalk.assert($1)){
  9173. return false;
  9174. };
  9175. $2=_st(_st(self)._size()).__eq(_st(aHashedCollection)._size());
  9176. if(! smalltalk.assert($2)){
  9177. return false;
  9178. };
  9179. $3=_st(_st(self)._associations()).__eq(_st(aHashedCollection)._associations());
  9180. return $3;
  9181. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)})},
  9182. args: ["aHashedCollection"],
  9183. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  9184. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  9185. referencedClasses: []
  9186. }),
  9187. smalltalk.HashedCollection);
  9188. smalltalk.addMethod(
  9189. "_add_",
  9190. smalltalk.method({
  9191. selector: "add:",
  9192. category: 'adding/removing',
  9193. fn: function (anAssociation){
  9194. var self=this;
  9195. return smalltalk.withContext(function($ctx1) { _st(self)._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  9196. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation}, smalltalk.HashedCollection)})},
  9197. args: ["anAssociation"],
  9198. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  9199. messageSends: ["at:put:", "key", "value"],
  9200. referencedClasses: []
  9201. }),
  9202. smalltalk.HashedCollection);
  9203. smalltalk.addMethod(
  9204. "_addAll_",
  9205. smalltalk.method({
  9206. selector: "addAll:",
  9207. category: 'adding/removing',
  9208. fn: function (aHashedCollection){
  9209. var self=this;
  9210. return smalltalk.withContext(function($ctx1) { var $1;
  9211. smalltalk.Collection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  9212. $1=aHashedCollection;
  9213. return $1;
  9214. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)})},
  9215. args: ["aHashedCollection"],
  9216. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  9217. messageSends: ["addAll:", "associations"],
  9218. referencedClasses: []
  9219. }),
  9220. smalltalk.HashedCollection);
  9221. smalltalk.addMethod(
  9222. "_asDictionary",
  9223. smalltalk.method({
  9224. selector: "asDictionary",
  9225. category: 'converting',
  9226. fn: function (){
  9227. var self=this;
  9228. return smalltalk.withContext(function($ctx1) { var $1;
  9229. $1=_st((smalltalk.Dictionary || Dictionary))._fromPairs_(_st(self)._associations());
  9230. return $1;
  9231. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{}, smalltalk.HashedCollection)})},
  9232. args: [],
  9233. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  9234. messageSends: ["fromPairs:", "associations"],
  9235. referencedClasses: ["Dictionary"]
  9236. }),
  9237. smalltalk.HashedCollection);
  9238. smalltalk.addMethod(
  9239. "_asJSON",
  9240. smalltalk.method({
  9241. selector: "asJSON",
  9242. category: 'converting',
  9243. fn: function (){
  9244. var self=this;
  9245. var c;
  9246. return smalltalk.withContext(function($ctx1) { var $1;
  9247. c=_st(_st(self)._class())._new();
  9248. _st(self)._keysAndValuesDo_((function(key,value){
  9249. return smalltalk.withContext(function($ctx2) { return _st(c)._at_put_(key,_st(value)._asJSON());
  9250. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  9251. $1=c;
  9252. return $1;
  9253. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c}, smalltalk.HashedCollection)})},
  9254. args: [],
  9255. 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",
  9256. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  9257. referencedClasses: []
  9258. }),
  9259. smalltalk.HashedCollection);
  9260. smalltalk.addMethod(
  9261. "_associations",
  9262. smalltalk.method({
  9263. selector: "associations",
  9264. category: 'accessing',
  9265. fn: function (){
  9266. var self=this;
  9267. var associations;
  9268. return smalltalk.withContext(function($ctx1) { var $1;
  9269. associations=[];
  9270. _st(_st(self)._keys())._do_((function(each){
  9271. return smalltalk.withContext(function($ctx2) { return _st(associations)._add_(_st((smalltalk.Association || Association))._key_value_(each,_st(self)._at_(each)));
  9272. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9273. $1=associations;
  9274. return $1;
  9275. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations}, smalltalk.HashedCollection)})},
  9276. args: [],
  9277. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self keys do: [:each |\x0a\x09 associations add: (Association key: each value: (self at: each))].\x0a\x09^associations",
  9278. messageSends: ["do:", "add:", "key:value:", "at:", "keys"],
  9279. referencedClasses: ["Association"]
  9280. }),
  9281. smalltalk.HashedCollection);
  9282. smalltalk.addMethod(
  9283. "_associationsDo_",
  9284. smalltalk.method({
  9285. selector: "associationsDo:",
  9286. category: 'enumerating',
  9287. fn: function (aBlock){
  9288. var self=this;
  9289. return smalltalk.withContext(function($ctx1) { _st(_st(self)._associations())._do_(aBlock);
  9290. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  9291. args: ["aBlock"],
  9292. source: "associationsDo: aBlock\x0a\x09self associations do: aBlock",
  9293. messageSends: ["do:", "associations"],
  9294. referencedClasses: []
  9295. }),
  9296. smalltalk.HashedCollection);
  9297. smalltalk.addMethod(
  9298. "_at_",
  9299. smalltalk.method({
  9300. selector: "at:",
  9301. category: 'accessing',
  9302. fn: function (aKey){
  9303. var self=this;
  9304. return smalltalk.withContext(function($ctx1) { var $1;
  9305. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  9306. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  9307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9308. return $1;
  9309. }, function($ctx1) {$ctx1.fill(self,"at:",{aKey:aKey}, smalltalk.HashedCollection)})},
  9310. args: ["aKey"],
  9311. source: "at: aKey\x0a\x09^self at: aKey ifAbsent: [self errorNotFound]",
  9312. messageSends: ["at:ifAbsent:", "errorNotFound"],
  9313. referencedClasses: []
  9314. }),
  9315. smalltalk.HashedCollection);
  9316. smalltalk.addMethod(
  9317. "_at_ifAbsent_",
  9318. smalltalk.method({
  9319. selector: "at:ifAbsent:",
  9320. category: 'accessing',
  9321. fn: function (aKey,aBlock){
  9322. var self=this;
  9323. return smalltalk.withContext(function($ctx1) { var $2,$1;
  9324. $2=_st(self)._includesKey_(aKey);
  9325. $1=_st($2)._ifTrue_ifFalse_((function(){
  9326. return smalltalk.withContext(function($ctx2) { return _st(self)._basicAt_(aKey);
  9327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  9328. return $1;
  9329. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  9330. args: ["aKey", "aBlock"],
  9331. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  9332. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  9333. referencedClasses: []
  9334. }),
  9335. smalltalk.HashedCollection);
  9336. smalltalk.addMethod(
  9337. "_at_ifAbsentPut_",
  9338. smalltalk.method({
  9339. selector: "at:ifAbsentPut:",
  9340. category: 'accessing',
  9341. fn: function (aKey,aBlock){
  9342. var self=this;
  9343. return smalltalk.withContext(function($ctx1) { var $1;
  9344. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  9345. return smalltalk.withContext(function($ctx2) { return _st(self)._at_put_(aKey,_st(aBlock)._value());
  9346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9347. return $1;
  9348. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  9349. args: ["aKey", "aBlock"],
  9350. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09 self at: aKey put: aBlock value]",
  9351. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  9352. referencedClasses: []
  9353. }),
  9354. smalltalk.HashedCollection);
  9355. smalltalk.addMethod(
  9356. "_at_ifPresent_",
  9357. smalltalk.method({
  9358. selector: "at:ifPresent:",
  9359. category: 'accessing',
  9360. fn: function (aKey,aBlock){
  9361. var self=this;
  9362. return smalltalk.withContext(function($ctx1) { var $2,$1;
  9363. $2=_st(self)._includesKey_(aKey);
  9364. if(smalltalk.assert($2)){
  9365. $1=_st(aBlock)._value_(_st(self)._at_(aKey));
  9366. } else {
  9367. $1=nil;
  9368. };
  9369. return $1;
  9370. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  9371. args: ["aKey", "aBlock"],
  9372. source: "at: aKey ifPresent: aBlock\x0a\x09\x22Lookup the given key in the receiver. \x0a\x09If it is present, answer the value of evaluating the given block with the value associated with the key. \x0a\x09Otherwise, answer nil.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ nil ]",
  9373. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  9374. referencedClasses: []
  9375. }),
  9376. smalltalk.HashedCollection);
  9377. smalltalk.addMethod(
  9378. "_at_ifPresent_ifAbsent_",
  9379. smalltalk.method({
  9380. selector: "at:ifPresent:ifAbsent:",
  9381. category: 'accessing',
  9382. fn: function (aKey,aBlock,anotherBlock){
  9383. var self=this;
  9384. return smalltalk.withContext(function($ctx1) { var $2,$1;
  9385. $2=_st(self)._includesKey_(aKey);
  9386. $1=_st($2)._ifTrue_ifFalse_((function(){
  9387. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._at_(aKey));
  9388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
  9389. return $1;
  9390. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)})},
  9391. args: ["aKey", "aBlock", "anotherBlock"],
  9392. 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",
  9393. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  9394. referencedClasses: []
  9395. }),
  9396. smalltalk.HashedCollection);
  9397. smalltalk.addMethod(
  9398. "_at_put_",
  9399. smalltalk.method({
  9400. selector: "at:put:",
  9401. category: 'accessing',
  9402. fn: function (aKey,aValue){
  9403. var self=this;
  9404. return smalltalk.withContext(function($ctx1) { var $1;
  9405. $1=_st(self)._basicAt_put_(aKey,aValue);
  9406. return $1;
  9407. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.HashedCollection)})},
  9408. args: ["aKey", "aValue"],
  9409. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  9410. messageSends: ["basicAt:put:"],
  9411. referencedClasses: []
  9412. }),
  9413. smalltalk.HashedCollection);
  9414. smalltalk.addMethod(
  9415. "_collect_",
  9416. smalltalk.method({
  9417. selector: "collect:",
  9418. category: 'enumerating',
  9419. fn: function (aBlock){
  9420. var self=this;
  9421. var newDict;
  9422. return smalltalk.withContext(function($ctx1) { var $1;
  9423. newDict=_st(_st(self)._class())._new();
  9424. _st(self)._keysAndValuesDo_((function(key,value){
  9425. return smalltalk.withContext(function($ctx2) { return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  9426. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  9427. $1=newDict;
  9428. return $1;
  9429. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)})},
  9430. args: ["aBlock"],
  9431. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 newDict at: key put: (aBlock value: value)].\x0a\x09^newDict",
  9432. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  9433. referencedClasses: []
  9434. }),
  9435. smalltalk.HashedCollection);
  9436. smalltalk.addMethod(
  9437. "_copyFrom_to_",
  9438. smalltalk.method({
  9439. selector: "copyFrom:to:",
  9440. category: 'copying',
  9441. fn: function (anIndex,anotherIndex){
  9442. var self=this;
  9443. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  9444. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.HashedCollection)})},
  9445. args: ["anIndex", "anotherIndex"],
  9446. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self shouldNotImplement",
  9447. messageSends: ["shouldNotImplement"],
  9448. referencedClasses: []
  9449. }),
  9450. smalltalk.HashedCollection);
  9451. smalltalk.addMethod(
  9452. "_deepCopy",
  9453. smalltalk.method({
  9454. selector: "deepCopy",
  9455. category: 'copying',
  9456. fn: function (){
  9457. var self=this;
  9458. var copy;
  9459. return smalltalk.withContext(function($ctx1) { var $1;
  9460. copy=_st(_st(self)._class())._new();
  9461. _st(self)._associationsDo_((function(each){
  9462. return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(_st(each)._key(),_st(_st(each)._value())._deepCopy());
  9463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9464. $1=copy;
  9465. return $1;
  9466. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy}, smalltalk.HashedCollection)})},
  9467. args: [],
  9468. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self associationsDo: [:each |\x0a\x09 copy at: each key put: each value deepCopy].\x0a\x09^copy",
  9469. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "deepCopy", "value"],
  9470. referencedClasses: []
  9471. }),
  9472. smalltalk.HashedCollection);
  9473. smalltalk.addMethod(
  9474. "_detect_ifNone_",
  9475. smalltalk.method({
  9476. selector: "detect:ifNone:",
  9477. category: 'enumerating',
  9478. fn: function (aBlock,anotherBlock){
  9479. var self=this;
  9480. return smalltalk.withContext(function($ctx1) { var $1;
  9481. $1=_st(_st(self)._values())._detect_ifNone_(aBlock,anotherBlock);
  9482. return $1;
  9483. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)})},
  9484. args: ["aBlock", "anotherBlock"],
  9485. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  9486. messageSends: ["detect:ifNone:", "values"],
  9487. referencedClasses: []
  9488. }),
  9489. smalltalk.HashedCollection);
  9490. smalltalk.addMethod(
  9491. "_do_",
  9492. smalltalk.method({
  9493. selector: "do:",
  9494. category: 'enumerating',
  9495. fn: function (aBlock){
  9496. var self=this;
  9497. return smalltalk.withContext(function($ctx1) { _st(_st(self)._values())._do_(aBlock);
  9498. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  9499. args: ["aBlock"],
  9500. source: "do: aBlock\x0a\x09self values do: aBlock",
  9501. messageSends: ["do:", "values"],
  9502. referencedClasses: []
  9503. }),
  9504. smalltalk.HashedCollection);
  9505. smalltalk.addMethod(
  9506. "_includes_",
  9507. smalltalk.method({
  9508. selector: "includes:",
  9509. category: 'enumerating',
  9510. fn: function (anObject){
  9511. var self=this;
  9512. return smalltalk.withContext(function($ctx1) { var $1;
  9513. $1=_st(_st(self)._values())._includes_(anObject);
  9514. return $1;
  9515. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.HashedCollection)})},
  9516. args: ["anObject"],
  9517. source: "includes: anObject\x0a\x09^self values includes: anObject",
  9518. messageSends: ["includes:", "values"],
  9519. referencedClasses: []
  9520. }),
  9521. smalltalk.HashedCollection);
  9522. smalltalk.addMethod(
  9523. "_includesKey_",
  9524. smalltalk.method({
  9525. selector: "includesKey:",
  9526. category: 'testing',
  9527. fn: function (aKey){
  9528. var self=this;
  9529. return smalltalk.withContext(function($ctx1) { return self.hasOwnProperty(aKey);
  9530. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.HashedCollection)})},
  9531. args: ["aKey"],
  9532. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  9533. messageSends: [],
  9534. referencedClasses: []
  9535. }),
  9536. smalltalk.HashedCollection);
  9537. smalltalk.addMethod(
  9538. "_keys",
  9539. smalltalk.method({
  9540. selector: "keys",
  9541. category: 'accessing',
  9542. fn: function (){
  9543. var self=this;
  9544. return smalltalk.withContext(function($ctx1) {
  9545. if ('function'===typeof Object.keys) return Object.keys(self);
  9546. var keys = [];
  9547. for(var i in self) {
  9548. if(self.hasOwnProperty(i)) {
  9549. keys.push(i);
  9550. }
  9551. };
  9552. return keys;
  9553. ;
  9554. return self}, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.HashedCollection)})},
  9555. args: [],
  9556. 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>",
  9557. messageSends: [],
  9558. referencedClasses: []
  9559. }),
  9560. smalltalk.HashedCollection);
  9561. smalltalk.addMethod(
  9562. "_keysAndValuesDo_",
  9563. smalltalk.method({
  9564. selector: "keysAndValuesDo:",
  9565. category: 'enumerating',
  9566. fn: function (aBlock){
  9567. var self=this;
  9568. return smalltalk.withContext(function($ctx1) { _st(self)._associationsDo_((function(each){
  9569. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(_st(each)._key(),_st(each)._value());
  9570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9571. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  9572. args: ["aBlock"],
  9573. source: "keysAndValuesDo: aBlock\x0a\x09self associationsDo: [:each |\x0a\x09 aBlock value: each key value: each value]",
  9574. messageSends: ["associationsDo:", "value:value:", "key", "value"],
  9575. referencedClasses: []
  9576. }),
  9577. smalltalk.HashedCollection);
  9578. smalltalk.addMethod(
  9579. "_printString",
  9580. smalltalk.method({
  9581. selector: "printString",
  9582. category: 'printing',
  9583. fn: function (){
  9584. var self=this;
  9585. return smalltalk.withContext(function($ctx1) { var $1;
  9586. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  9587. return smalltalk.withContext(function($ctx2) { _st(aStream)._nextPutAll_(_st(_st("a ").__comma(_st(_st(self)._class())._name())).__comma("("));
  9588. _st(_st(self)._associations())._do_separatedBy_((function(each){
  9589. return smalltalk.withContext(function($ctx3) { return _st(each)._storeOn_(aStream);
  9590. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  9591. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(" , ");
  9592. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  9593. return _st(aStream)._nextPutAll_(")");
  9594. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  9595. return $1;
  9596. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.HashedCollection)})},
  9597. args: [],
  9598. source: "printString\x0a\x09\x22print the contents of the HashedCollection into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream nextPutAll: 'a ', self class name, '('.\x0a\x09\x09self associations\x0a\x09\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' , '].\x0a\x09\x09aStream nextPutAll: ')']",
  9599. messageSends: ["streamContents:", "nextPutAll:", ",", "name", "class", "do:separatedBy:", "storeOn:", "associations"],
  9600. referencedClasses: ["String"]
  9601. }),
  9602. smalltalk.HashedCollection);
  9603. smalltalk.addMethod(
  9604. "_remove_ifAbsent_",
  9605. smalltalk.method({
  9606. selector: "remove:ifAbsent:",
  9607. category: 'adding/removing',
  9608. fn: function (aKey,aBlock){
  9609. var self=this;
  9610. return smalltalk.withContext(function($ctx1) { var $1;
  9611. $1=_st(self)._removeKey_ifAbsent_(aKey,aBlock);
  9612. return $1;
  9613. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  9614. args: ["aKey", "aBlock"],
  9615. source: "remove: aKey ifAbsent: aBlock\x0a ^self removeKey: aKey ifAbsent: aBlock",
  9616. messageSends: ["removeKey:ifAbsent:"],
  9617. referencedClasses: []
  9618. }),
  9619. smalltalk.HashedCollection);
  9620. smalltalk.addMethod(
  9621. "_removeKey_",
  9622. smalltalk.method({
  9623. selector: "removeKey:",
  9624. category: 'adding/removing',
  9625. fn: function (aKey){
  9626. var self=this;
  9627. return smalltalk.withContext(function($ctx1) { var $1;
  9628. $1=_st(self)._remove_(aKey);
  9629. return $1;
  9630. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey}, smalltalk.HashedCollection)})},
  9631. args: ["aKey"],
  9632. source: "removeKey: aKey\x0a ^self remove: aKey",
  9633. messageSends: ["remove:"],
  9634. referencedClasses: []
  9635. }),
  9636. smalltalk.HashedCollection);
  9637. smalltalk.addMethod(
  9638. "_removeKey_ifAbsent_",
  9639. smalltalk.method({
  9640. selector: "removeKey:ifAbsent:",
  9641. category: 'adding/removing',
  9642. fn: function (aKey,aBlock){
  9643. var self=this;
  9644. return smalltalk.withContext(function($ctx1) { var $2,$1;
  9645. $2=_st(self)._includesKey_(aKey);
  9646. if(smalltalk.assert($2)){
  9647. $1=_st(self)._basicDelete_(aKey);
  9648. } else {
  9649. $1=_st(aBlock)._value();
  9650. };
  9651. return $1;
  9652. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  9653. args: ["aKey", "aBlock"],
  9654. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey) \x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  9655. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  9656. referencedClasses: []
  9657. }),
  9658. smalltalk.HashedCollection);
  9659. smalltalk.addMethod(
  9660. "_select_",
  9661. smalltalk.method({
  9662. selector: "select:",
  9663. category: 'enumerating',
  9664. fn: function (aBlock){
  9665. var self=this;
  9666. var newDict;
  9667. return smalltalk.withContext(function($ctx1) { var $1,$2;
  9668. newDict=_st(_st(self)._class())._new();
  9669. _st(self)._keysAndValuesDo_((function(key,value){
  9670. return smalltalk.withContext(function($ctx2) { $1=_st(aBlock)._value_(value);
  9671. if(smalltalk.assert($1)){
  9672. return _st(newDict)._at_put_(key,value);
  9673. };
  9674. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  9675. $2=newDict;
  9676. return $2;
  9677. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)})},
  9678. args: ["aBlock"],
  9679. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 (aBlock value: value) ifTrue: [newDict at: key put: value]].\x0a\x09^newDict",
  9680. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  9681. referencedClasses: []
  9682. }),
  9683. smalltalk.HashedCollection);
  9684. smalltalk.addMethod(
  9685. "_shallowCopy",
  9686. smalltalk.method({
  9687. selector: "shallowCopy",
  9688. category: 'copying',
  9689. fn: function (){
  9690. var self=this;
  9691. var copy;
  9692. return smalltalk.withContext(function($ctx1) { var $1;
  9693. copy=_st(_st(self)._class())._new();
  9694. _st(self)._associationsDo_((function(each){
  9695. return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(_st(each)._key(),_st(each)._value());
  9696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9697. $1=copy;
  9698. return $1;
  9699. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy}, smalltalk.HashedCollection)})},
  9700. args: [],
  9701. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self associationsDo: [:each |\x0a\x09 copy at: each key put: each value].\x0a\x09^copy",
  9702. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "value"],
  9703. referencedClasses: []
  9704. }),
  9705. smalltalk.HashedCollection);
  9706. smalltalk.addMethod(
  9707. "_size",
  9708. smalltalk.method({
  9709. selector: "size",
  9710. category: 'accessing',
  9711. fn: function (){
  9712. var self=this;
  9713. return smalltalk.withContext(function($ctx1) { var $1;
  9714. $1=_st(_st(self)._keys())._size();
  9715. return $1;
  9716. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.HashedCollection)})},
  9717. args: [],
  9718. source: "size\x0a\x09^self keys size",
  9719. messageSends: ["size", "keys"],
  9720. referencedClasses: []
  9721. }),
  9722. smalltalk.HashedCollection);
  9723. smalltalk.addMethod(
  9724. "_storeOn_",
  9725. smalltalk.method({
  9726. selector: "storeOn:",
  9727. category: 'printing',
  9728. fn: function (aStream){
  9729. var self=this;
  9730. return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_("#{");
  9731. _st(_st(self)._associations())._do_separatedBy_((function(each){
  9732. return smalltalk.withContext(function($ctx2) { return _st(each)._storeOn_(aStream);
  9733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  9734. return smalltalk.withContext(function($ctx2) { return _st(aStream)._nextPutAll_(". ");
  9735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9736. _st(aStream)._nextPutAll_("}");
  9737. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.HashedCollection)})},
  9738. args: ["aStream"],
  9739. source: "storeOn: aStream\x0a\x09aStream nextPutAll: '#{'.\x0a\x09self associations\x0a\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09separatedBy: [ aStream nextPutAll: '. '].\x0a\x09aStream nextPutAll: '}'",
  9740. messageSends: ["nextPutAll:", "do:separatedBy:", "storeOn:", "associations"],
  9741. referencedClasses: []
  9742. }),
  9743. smalltalk.HashedCollection);
  9744. smalltalk.addMethod(
  9745. "_values",
  9746. smalltalk.method({
  9747. selector: "values",
  9748. category: 'accessing',
  9749. fn: function (){
  9750. var self=this;
  9751. return smalltalk.withContext(function($ctx1) { var $1;
  9752. $1=_st(_st(self)._keys())._collect_((function(each){
  9753. return smalltalk.withContext(function($ctx2) { return _st(self)._at_(each);
  9754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9755. return $1;
  9756. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.HashedCollection)})},
  9757. args: [],
  9758. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  9759. messageSends: ["collect:", "at:", "keys"],
  9760. referencedClasses: []
  9761. }),
  9762. smalltalk.HashedCollection);
  9763. smalltalk.addMethod(
  9764. "_fromPairs_",
  9765. smalltalk.method({
  9766. selector: "fromPairs:",
  9767. category: 'instance creation',
  9768. fn: function (aCollection){
  9769. var self=this;
  9770. var dict;
  9771. return smalltalk.withContext(function($ctx1) { var $1;
  9772. dict=_st(self)._new();
  9773. _st(aCollection)._do_((function(each){
  9774. return smalltalk.withContext(function($ctx2) { return _st(dict)._add_(each);
  9775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  9776. $1=dict;
  9777. return $1;
  9778. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection,dict:dict}, smalltalk.HashedCollection.klass)})},
  9779. args: ["aCollection"],
  9780. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  9781. messageSends: ["new", "do:", "add:"],
  9782. referencedClasses: []
  9783. }),
  9784. smalltalk.HashedCollection.klass);
  9785. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  9786. smalltalk.addMethod(
  9787. "_asHashedCollection",
  9788. smalltalk.method({
  9789. selector: "asHashedCollection",
  9790. category: 'converting',
  9791. fn: function (){
  9792. var self=this;
  9793. return smalltalk.withContext(function($ctx1) { var $1;
  9794. $1=_st((smalltalk.HashedCollection || HashedCollection))._fromPairs_(_st(self)._associations());
  9795. return $1;
  9796. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{}, smalltalk.Dictionary)})},
  9797. args: [],
  9798. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  9799. messageSends: ["fromPairs:", "associations"],
  9800. referencedClasses: ["HashedCollection"]
  9801. }),
  9802. smalltalk.Dictionary);
  9803. smalltalk.addMethod(
  9804. "_asJSON",
  9805. smalltalk.method({
  9806. selector: "asJSON",
  9807. category: 'converting',
  9808. fn: function (){
  9809. var self=this;
  9810. return smalltalk.withContext(function($ctx1) { var $1;
  9811. $1=_st(_st(self)._asHashedCollection())._asJSON();
  9812. return $1;
  9813. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Dictionary)})},
  9814. args: [],
  9815. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  9816. messageSends: ["asJSON", "asHashedCollection"],
  9817. referencedClasses: []
  9818. }),
  9819. smalltalk.Dictionary);
  9820. smalltalk.addMethod(
  9821. "_at_ifAbsent_",
  9822. smalltalk.method({
  9823. selector: "at:ifAbsent:",
  9824. category: 'accessing',
  9825. fn: function (aKey,aBlock){
  9826. var self=this;
  9827. return smalltalk.withContext(function($ctx1) {
  9828. var index;
  9829. for(var i=0;i<self['@keys'].length;i++){
  9830. if(self['@keys'][i].__eq(aKey)) {index = i;}
  9831. };
  9832. if(typeof index === 'undefined') {
  9833. return aBlock();
  9834. } else {
  9835. return self['@values'][index];
  9836. }
  9837. ;
  9838. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)})},
  9839. args: ["aKey", "aBlock"],
  9840. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index;\x0a\x09\x09for(var i=0;i<self['@keys'].length;i++){\x0a\x09\x09\x09if(self['@keys'][i].__eq(aKey)) {index = i;}\x0a\x09\x09};\x0a\x09\x09if(typeof index === 'undefined') {\x0a\x09\x09\x09return aBlock();\x0a\x09\x09} else {\x0a\x09\x09\x09return self['@values'][index];\x0a\x09\x09}\x0a\x09>",
  9841. messageSends: [],
  9842. referencedClasses: []
  9843. }),
  9844. smalltalk.Dictionary);
  9845. smalltalk.addMethod(
  9846. "_at_put_",
  9847. smalltalk.method({
  9848. selector: "at:put:",
  9849. category: 'accessing',
  9850. fn: function (aKey,aValue){
  9851. var self=this;
  9852. return smalltalk.withContext(function($ctx1) {
  9853. var index = self['@keys'].indexOf(aKey);
  9854. if(index === -1) {
  9855. self['@values'].push(aValue);
  9856. self['@keys'].push(aKey);
  9857. } else {
  9858. self['@values'][index] = aValue;
  9859. };
  9860. return aValue;
  9861. ;
  9862. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.Dictionary)})},
  9863. args: ["aKey", "aValue"],
  9864. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self['@keys'].indexOf(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09self['@values'].push(aValue);\x0a\x09\x09\x09self['@keys'].push(aKey);\x0a\x09\x09} else {\x0a\x09\x09\x09self['@values'][index] = aValue;\x0a\x09\x09};\x0a\x0a\x09\x09return aValue;\x0a\x09>",
  9865. messageSends: [],
  9866. referencedClasses: []
  9867. }),
  9868. smalltalk.Dictionary);
  9869. smalltalk.addMethod(
  9870. "_includesKey_",
  9871. smalltalk.method({
  9872. selector: "includesKey:",
  9873. category: 'testing',
  9874. fn: function (aKey){
  9875. var self=this;
  9876. return smalltalk.withContext(function($ctx1) { var $1;
  9877. $1=_st(self["@keys"])._includes_(aKey);
  9878. return $1;
  9879. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.Dictionary)})},
  9880. args: ["aKey"],
  9881. source: "includesKey: aKey\x0a\x09^keys includes: aKey",
  9882. messageSends: ["includes:"],
  9883. referencedClasses: []
  9884. }),
  9885. smalltalk.Dictionary);
  9886. smalltalk.addMethod(
  9887. "_initialize",
  9888. smalltalk.method({
  9889. selector: "initialize",
  9890. category: 'initialization',
  9891. fn: function (){
  9892. var self=this;
  9893. return smalltalk.withContext(function($ctx1) { smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
  9894. self["@keys"]=[];
  9895. self["@values"]=[];
  9896. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Dictionary)})},
  9897. args: [],
  9898. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9899. messageSends: ["initialize"],
  9900. referencedClasses: []
  9901. }),
  9902. smalltalk.Dictionary);
  9903. smalltalk.addMethod(
  9904. "_keyAtValue_",
  9905. smalltalk.method({
  9906. selector: "keyAtValue:",
  9907. category: 'accessing',
  9908. fn: function (anObject){
  9909. var self=this;
  9910. return smalltalk.withContext(function($ctx1) { var $1;
  9911. $1=_st(_st(_st(self)._associations())._detect_ifNone_((function(k,v){
  9912. return smalltalk.withContext(function($ctx2) { return _st(v).__eq_eq(anObject);
  9913. }, function($ctx2) {$ctx2.fillBlock({k:k,v:v},$ctx1)})}),(function(){
  9914. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Not found");
  9915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._key();
  9916. return $1;
  9917. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject}, smalltalk.Dictionary)})},
  9918. args: ["anObject"],
  9919. source: "keyAtValue: anObject\x0a\x0a\x09^ (self associations \x0a \x09detect:[:k :v| v == anObject] \x0a \x09ifNone:[self error: 'Not found']) key",
  9920. messageSends: ["key", "detect:ifNone:", "==", "error:", "associations"],
  9921. referencedClasses: []
  9922. }),
  9923. smalltalk.Dictionary);
  9924. smalltalk.addMethod(
  9925. "_keys",
  9926. smalltalk.method({
  9927. selector: "keys",
  9928. category: 'accessing',
  9929. fn: function (){
  9930. var self=this;
  9931. return smalltalk.withContext(function($ctx1) { var $1;
  9932. $1=_st(self["@keys"])._copy();
  9933. return $1;
  9934. }, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.Dictionary)})},
  9935. args: [],
  9936. source: "keys\x0a\x09^keys copy",
  9937. messageSends: ["copy"],
  9938. referencedClasses: []
  9939. }),
  9940. smalltalk.Dictionary);
  9941. smalltalk.addMethod(
  9942. "_removeKey_ifAbsent_",
  9943. smalltalk.method({
  9944. selector: "removeKey:ifAbsent:",
  9945. category: 'adding/removing',
  9946. fn: function (aKey,aBlock){
  9947. var self=this;
  9948. return smalltalk.withContext(function($ctx1) {
  9949. var index = self['@keys'].indexOf(aKey);
  9950. if(index === -1) {
  9951. return aBlock()
  9952. } else {
  9953. var value;
  9954. self['@keys'].splice(index, 1);
  9955. value = self['@values'].splice(index, 1);
  9956. return value[0];
  9957. };
  9958. ;
  9959. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)})},
  9960. args: ["aKey", "aBlock"],
  9961. source: "removeKey: aKey ifAbsent: aBlock\x0a <\x0a var index = self['@keys'].indexOf(aKey);\x0a if(index === -1) {\x0a return aBlock()\x0a } else {\x0a var value;\x0a self['@keys'].splice(index, 1);\x0a value = self['@values'].splice(index, 1);\x0a return value[0];\x0a };\x0a >",
  9962. messageSends: [],
  9963. referencedClasses: []
  9964. }),
  9965. smalltalk.Dictionary);
  9966. smalltalk.addMethod(
  9967. "_valueAt_",
  9968. smalltalk.method({
  9969. selector: "valueAt:",
  9970. category: 'accessing',
  9971. fn: function (anObject){
  9972. var self=this;
  9973. return smalltalk.withContext(function($ctx1) { var $1;
  9974. $1=_st(self)._associationsDo_((2));
  9975. return $1;
  9976. }, function($ctx1) {$ctx1.fill(self,"valueAt:",{anObject:anObject}, smalltalk.Dictionary)})},
  9977. args: ["anObject"],
  9978. source: "valueAt: anObject\x0a\x0a\x09^ self associationsDo:2",
  9979. messageSends: ["associationsDo:"],
  9980. referencedClasses: []
  9981. }),
  9982. smalltalk.Dictionary);
  9983. smalltalk.addMethod(
  9984. "_values",
  9985. smalltalk.method({
  9986. selector: "values",
  9987. category: 'accessing',
  9988. fn: function (){
  9989. var self=this;
  9990. return smalltalk.withContext(function($ctx1) { var $1;
  9991. $1=_st(self["@values"])._copy();
  9992. return $1;
  9993. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.Dictionary)})},
  9994. args: [],
  9995. source: "values\x0a\x09^values copy",
  9996. messageSends: ["copy"],
  9997. referencedClasses: []
  9998. }),
  9999. smalltalk.Dictionary);
  10000. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  10001. smalltalk.addMethod(
  10002. "__eq",
  10003. smalltalk.method({
  10004. selector: "=",
  10005. category: 'comparing',
  10006. fn: function (aCollection){
  10007. var self=this;
  10008. return smalltalk.withContext(function($ctx1) { var $1,$2;
  10009. var $early={};
  10010. try {
  10011. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  10012. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._size()).__eq(_st(aCollection)._size());
  10013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10014. if(! smalltalk.assert($1)){
  10015. return false;
  10016. };
  10017. _st(self)._withIndexDo_((function(each,i){
  10018. return smalltalk.withContext(function($ctx2) { $2=_st(_st(aCollection)._at_(i)).__eq(each);
  10019. if(! smalltalk.assert($2)){
  10020. throw $early=[false];
  10021. };
  10022. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  10023. return true;
  10024. }
  10025. catch(e) {if(e===$early)return e[0]; throw e}
  10026. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.SequenceableCollection)})},
  10027. args: ["aCollection"],
  10028. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size]) ifFalse: [^false].\x0a\x09self withIndexDo: [:each :i |\x0a (aCollection at: i) = each ifFalse: [^false]].\x0a\x09^true",
  10029. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  10030. referencedClasses: []
  10031. }),
  10032. smalltalk.SequenceableCollection);
  10033. smalltalk.addMethod(
  10034. "_addLast_",
  10035. smalltalk.method({
  10036. selector: "addLast:",
  10037. category: 'adding',
  10038. fn: function (anObject){
  10039. var self=this;
  10040. return smalltalk.withContext(function($ctx1) { _st(self)._add_(anObject);
  10041. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject}, smalltalk.SequenceableCollection)})},
  10042. args: ["anObject"],
  10043. source: "addLast: anObject\x0a\x09self add: anObject",
  10044. messageSends: ["add:"],
  10045. referencedClasses: []
  10046. }),
  10047. smalltalk.SequenceableCollection);
  10048. smalltalk.addMethod(
  10049. "_allButFirst",
  10050. smalltalk.method({
  10051. selector: "allButFirst",
  10052. category: 'accessing',
  10053. fn: function (){
  10054. var self=this;
  10055. return smalltalk.withContext(function($ctx1) { var $1;
  10056. $1=_st(self)._copyFrom_to_((2),_st(self)._size());
  10057. return $1;
  10058. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{}, smalltalk.SequenceableCollection)})},
  10059. args: [],
  10060. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  10061. messageSends: ["copyFrom:to:", "size"],
  10062. referencedClasses: []
  10063. }),
  10064. smalltalk.SequenceableCollection);
  10065. smalltalk.addMethod(
  10066. "_allButLast",
  10067. smalltalk.method({
  10068. selector: "allButLast",
  10069. category: 'accessing',
  10070. fn: function (){
  10071. var self=this;
  10072. return smalltalk.withContext(function($ctx1) { var $1;
  10073. $1=_st(self)._copyFrom_to_((1),_st(_st(self)._size()).__minus((1)));
  10074. return $1;
  10075. }, function($ctx1) {$ctx1.fill(self,"allButLast",{}, smalltalk.SequenceableCollection)})},
  10076. args: [],
  10077. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  10078. messageSends: ["copyFrom:to:", "-", "size"],
  10079. referencedClasses: []
  10080. }),
  10081. smalltalk.SequenceableCollection);
  10082. smalltalk.addMethod(
  10083. "_at_",
  10084. smalltalk.method({
  10085. selector: "at:",
  10086. category: 'accessing',
  10087. fn: function (anIndex){
  10088. var self=this;
  10089. return smalltalk.withContext(function($ctx1) { var $1;
  10090. $1=_st(self)._at_ifAbsent_(anIndex,(function(){
  10091. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  10092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10093. return $1;
  10094. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex}, smalltalk.SequenceableCollection)})},
  10095. args: ["anIndex"],
  10096. source: "at: anIndex\x0a\x09^self at: anIndex ifAbsent: [\x0a\x09 self errorNotFound]",
  10097. messageSends: ["at:ifAbsent:", "errorNotFound"],
  10098. referencedClasses: []
  10099. }),
  10100. smalltalk.SequenceableCollection);
  10101. smalltalk.addMethod(
  10102. "_at_ifAbsent_",
  10103. smalltalk.method({
  10104. selector: "at:ifAbsent:",
  10105. category: 'accessing',
  10106. fn: function (anIndex,aBlock){
  10107. var self=this;
  10108. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  10109. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  10110. args: ["anIndex", "aBlock"],
  10111. source: "at: anIndex ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10112. messageSends: ["subclassResponsibility"],
  10113. referencedClasses: []
  10114. }),
  10115. smalltalk.SequenceableCollection);
  10116. smalltalk.addMethod(
  10117. "_at_put_",
  10118. smalltalk.method({
  10119. selector: "at:put:",
  10120. category: 'accessing',
  10121. fn: function (anIndex,anObject){
  10122. var self=this;
  10123. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  10124. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.SequenceableCollection)})},
  10125. args: ["anIndex", "anObject"],
  10126. source: "at: anIndex put: anObject\x0a\x09self subclassResponsibility",
  10127. messageSends: ["subclassResponsibility"],
  10128. referencedClasses: []
  10129. }),
  10130. smalltalk.SequenceableCollection);
  10131. smalltalk.addMethod(
  10132. "_atRandom",
  10133. smalltalk.method({
  10134. selector: "atRandom",
  10135. category: 'accessing',
  10136. fn: function (){
  10137. var self=this;
  10138. return smalltalk.withContext(function($ctx1) { var $1;
  10139. $1=_st(self)._at_(_st(_st(self)._size())._atRandom());
  10140. return $1;
  10141. }, function($ctx1) {$ctx1.fill(self,"atRandom",{}, smalltalk.SequenceableCollection)})},
  10142. args: [],
  10143. source: "atRandom\x0a\x09^ self at: self size atRandom",
  10144. messageSends: ["at:", "atRandom", "size"],
  10145. referencedClasses: []
  10146. }),
  10147. smalltalk.SequenceableCollection);
  10148. smalltalk.addMethod(
  10149. "_copyFrom_to_",
  10150. smalltalk.method({
  10151. selector: "copyFrom:to:",
  10152. category: 'copying',
  10153. fn: function (anIndex,anotherIndex){
  10154. var self=this;
  10155. var range,newCollection;
  10156. return smalltalk.withContext(function($ctx1) { var $1;
  10157. range=_st(anIndex)._to_(anotherIndex);
  10158. newCollection=_st(_st(self)._class())._new_(_st(range)._size());
  10159. _st(range)._withIndexDo_((function(each,i){
  10160. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(i,_st(self)._at_(each));
  10161. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  10162. $1=newCollection;
  10163. return $1;
  10164. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection}, smalltalk.SequenceableCollection)})},
  10165. args: ["anIndex", "anotherIndex"],
  10166. 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 newCollection at: i put: (self at: each)].\x0a\x09^newCollection",
  10167. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  10168. referencedClasses: []
  10169. }),
  10170. smalltalk.SequenceableCollection);
  10171. smalltalk.addMethod(
  10172. "_deepCopy",
  10173. smalltalk.method({
  10174. selector: "deepCopy",
  10175. category: 'copying',
  10176. fn: function (){
  10177. var self=this;
  10178. var newCollection;
  10179. return smalltalk.withContext(function($ctx1) { var $1;
  10180. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  10181. _st(self)._withIndexDo_((function(each,index){
  10182. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  10183. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  10184. $1=newCollection;
  10185. return $1;
  10186. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)})},
  10187. args: [],
  10188. 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",
  10189. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  10190. referencedClasses: []
  10191. }),
  10192. smalltalk.SequenceableCollection);
  10193. smalltalk.addMethod(
  10194. "_first",
  10195. smalltalk.method({
  10196. selector: "first",
  10197. category: 'accessing',
  10198. fn: function (){
  10199. var self=this;
  10200. return smalltalk.withContext(function($ctx1) { var $1;
  10201. $1=_st(self)._at_((1));
  10202. return $1;
  10203. }, function($ctx1) {$ctx1.fill(self,"first",{}, smalltalk.SequenceableCollection)})},
  10204. args: [],
  10205. source: "first\x0a\x09^self at: 1",
  10206. messageSends: ["at:"],
  10207. referencedClasses: []
  10208. }),
  10209. smalltalk.SequenceableCollection);
  10210. smalltalk.addMethod(
  10211. "_first_",
  10212. smalltalk.method({
  10213. selector: "first:",
  10214. category: 'accessing',
  10215. fn: function (n){
  10216. var self=this;
  10217. return smalltalk.withContext(function($ctx1) { var $1;
  10218. $1=_st(self)._copyFrom_to_((1),n);
  10219. return $1;
  10220. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n}, smalltalk.SequenceableCollection)})},
  10221. args: ["n"],
  10222. 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",
  10223. messageSends: ["copyFrom:to:"],
  10224. referencedClasses: []
  10225. }),
  10226. smalltalk.SequenceableCollection);
  10227. smalltalk.addMethod(
  10228. "_fourth",
  10229. smalltalk.method({
  10230. selector: "fourth",
  10231. category: 'accessing',
  10232. fn: function (){
  10233. var self=this;
  10234. return smalltalk.withContext(function($ctx1) { var $1;
  10235. $1=_st(self)._at_((4));
  10236. return $1;
  10237. }, function($ctx1) {$ctx1.fill(self,"fourth",{}, smalltalk.SequenceableCollection)})},
  10238. args: [],
  10239. source: "fourth\x0a\x09^self at: 4",
  10240. messageSends: ["at:"],
  10241. referencedClasses: []
  10242. }),
  10243. smalltalk.SequenceableCollection);
  10244. smalltalk.addMethod(
  10245. "_includes_",
  10246. smalltalk.method({
  10247. selector: "includes:",
  10248. category: 'testing',
  10249. fn: function (anObject){
  10250. var self=this;
  10251. return smalltalk.withContext(function($ctx1) { var $1;
  10252. $1=_st(_st(self)._indexOf_ifAbsent_(anObject,(function(){
  10253. return smalltalk.withContext(function($ctx2) { return nil;
  10254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil();
  10255. return $1;
  10256. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.SequenceableCollection)})},
  10257. args: ["anObject"],
  10258. source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
  10259. messageSends: ["notNil", "indexOf:ifAbsent:"],
  10260. referencedClasses: []
  10261. }),
  10262. smalltalk.SequenceableCollection);
  10263. smalltalk.addMethod(
  10264. "_indexOf_",
  10265. smalltalk.method({
  10266. selector: "indexOf:",
  10267. category: 'accessing',
  10268. fn: function (anObject){
  10269. var self=this;
  10270. return smalltalk.withContext(function($ctx1) { var $1;
  10271. $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){
  10272. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  10273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10274. return $1;
  10275. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject}, smalltalk.SequenceableCollection)})},
  10276. args: ["anObject"],
  10277. source: "indexOf: anObject\x0a\x09^self indexOf: anObject ifAbsent: [self errorNotFound]",
  10278. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  10279. referencedClasses: []
  10280. }),
  10281. smalltalk.SequenceableCollection);
  10282. smalltalk.addMethod(
  10283. "_indexOf_ifAbsent_",
  10284. smalltalk.method({
  10285. selector: "indexOf:ifAbsent:",
  10286. category: 'accessing',
  10287. fn: function (anObject,aBlock){
  10288. var self=this;
  10289. return smalltalk.withContext(function($ctx1) {
  10290. for(var i=0;i<self.length;i++) {
  10291. if(self[i].__eq(anObject)) {return i+1}
  10292. };
  10293. return aBlock();
  10294. ;
  10295. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  10296. args: ["anObject", "aBlock"],
  10297. 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>",
  10298. messageSends: [],
  10299. referencedClasses: []
  10300. }),
  10301. smalltalk.SequenceableCollection);
  10302. smalltalk.addMethod(
  10303. "_indexOf_startingAt_",
  10304. smalltalk.method({
  10305. selector: "indexOf:startingAt:",
  10306. category: 'accessing',
  10307. fn: function (anObject,start){
  10308. var self=this;
  10309. return smalltalk.withContext(function($ctx1) { var $1;
  10310. $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10311. return smalltalk.withContext(function($ctx2) { return (0);
  10312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10313. return $1;
  10314. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start}, smalltalk.SequenceableCollection)})},
  10315. args: ["anObject", "start"],
  10316. 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]",
  10317. messageSends: ["indexOf:startingAt:ifAbsent:"],
  10318. referencedClasses: []
  10319. }),
  10320. smalltalk.SequenceableCollection);
  10321. smalltalk.addMethod(
  10322. "_indexOf_startingAt_ifAbsent_",
  10323. smalltalk.method({
  10324. selector: "indexOf:startingAt:ifAbsent:",
  10325. category: 'accessing',
  10326. fn: function (anObject,start,aBlock){
  10327. var self=this;
  10328. return smalltalk.withContext(function($ctx1) {
  10329. for(var i=start-1;i<self.length;i++){
  10330. if(self[i].__eq(anObject)) {return i+1}
  10331. }
  10332. return aBlock();
  10333. ;
  10334. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  10335. args: ["anObject", "start", "aBlock"],
  10336. 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>",
  10337. messageSends: [],
  10338. referencedClasses: []
  10339. }),
  10340. smalltalk.SequenceableCollection);
  10341. smalltalk.addMethod(
  10342. "_last",
  10343. smalltalk.method({
  10344. selector: "last",
  10345. category: 'accessing',
  10346. fn: function (){
  10347. var self=this;
  10348. return smalltalk.withContext(function($ctx1) { var $1;
  10349. $1=_st(self)._at_(_st(self)._size());
  10350. return $1;
  10351. }, function($ctx1) {$ctx1.fill(self,"last",{}, smalltalk.SequenceableCollection)})},
  10352. args: [],
  10353. source: "last\x0a\x09^self at: self size",
  10354. messageSends: ["at:", "size"],
  10355. referencedClasses: []
  10356. }),
  10357. smalltalk.SequenceableCollection);
  10358. smalltalk.addMethod(
  10359. "_removeLast",
  10360. smalltalk.method({
  10361. selector: "removeLast",
  10362. category: 'adding',
  10363. fn: function (){
  10364. var self=this;
  10365. return smalltalk.withContext(function($ctx1) { _st(self)._remove_(_st(self)._last());
  10366. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{}, smalltalk.SequenceableCollection)})},
  10367. args: [],
  10368. source: "removeLast\x0a\x09self remove: self last",
  10369. messageSends: ["remove:", "last"],
  10370. referencedClasses: []
  10371. }),
  10372. smalltalk.SequenceableCollection);
  10373. smalltalk.addMethod(
  10374. "_reversed",
  10375. smalltalk.method({
  10376. selector: "reversed",
  10377. category: 'converting',
  10378. fn: function (){
  10379. var self=this;
  10380. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  10381. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.SequenceableCollection)})},
  10382. args: [],
  10383. source: "reversed\x0a\x09self subclassResponsibility",
  10384. messageSends: ["subclassResponsibility"],
  10385. referencedClasses: []
  10386. }),
  10387. smalltalk.SequenceableCollection);
  10388. smalltalk.addMethod(
  10389. "_second",
  10390. smalltalk.method({
  10391. selector: "second",
  10392. category: 'accessing',
  10393. fn: function (){
  10394. var self=this;
  10395. return smalltalk.withContext(function($ctx1) { var $1;
  10396. $1=_st(self)._at_((2));
  10397. return $1;
  10398. }, function($ctx1) {$ctx1.fill(self,"second",{}, smalltalk.SequenceableCollection)})},
  10399. args: [],
  10400. source: "second\x0a\x09^self at: 2",
  10401. messageSends: ["at:"],
  10402. referencedClasses: []
  10403. }),
  10404. smalltalk.SequenceableCollection);
  10405. smalltalk.addMethod(
  10406. "_shallowCopy",
  10407. smalltalk.method({
  10408. selector: "shallowCopy",
  10409. category: 'copying',
  10410. fn: function (){
  10411. var self=this;
  10412. var newCollection;
  10413. return smalltalk.withContext(function($ctx1) { var $1;
  10414. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  10415. _st(self)._withIndexDo_((function(each,index){
  10416. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,each);
  10417. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  10418. $1=newCollection;
  10419. return $1;
  10420. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)})},
  10421. args: [],
  10422. 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",
  10423. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  10424. referencedClasses: []
  10425. }),
  10426. smalltalk.SequenceableCollection);
  10427. smalltalk.addMethod(
  10428. "_third",
  10429. smalltalk.method({
  10430. selector: "third",
  10431. category: 'accessing',
  10432. fn: function (){
  10433. var self=this;
  10434. return smalltalk.withContext(function($ctx1) { var $1;
  10435. $1=_st(self)._at_((3));
  10436. return $1;
  10437. }, function($ctx1) {$ctx1.fill(self,"third",{}, smalltalk.SequenceableCollection)})},
  10438. args: [],
  10439. source: "third\x0a\x09^self at: 3",
  10440. messageSends: ["at:"],
  10441. referencedClasses: []
  10442. }),
  10443. smalltalk.SequenceableCollection);
  10444. smalltalk.addMethod(
  10445. "_withIndexDo_",
  10446. smalltalk.method({
  10447. selector: "withIndexDo:",
  10448. category: 'enumerating',
  10449. fn: function (aBlock){
  10450. var self=this;
  10451. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  10452. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  10453. args: ["aBlock"],
  10454. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  10455. messageSends: [],
  10456. referencedClasses: []
  10457. }),
  10458. smalltalk.SequenceableCollection);
  10459. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  10460. smalltalk.addMethod(
  10461. "_add_",
  10462. smalltalk.method({
  10463. selector: "add:",
  10464. category: 'adding/removing',
  10465. fn: function (anObject){
  10466. var self=this;
  10467. return smalltalk.withContext(function($ctx1) { self.push(anObject); return anObject;;
  10468. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Array)})},
  10469. args: ["anObject"],
  10470. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  10471. messageSends: [],
  10472. referencedClasses: []
  10473. }),
  10474. smalltalk.Array);
  10475. smalltalk.addMethod(
  10476. "_asJavascript",
  10477. smalltalk.method({
  10478. selector: "asJavascript",
  10479. category: 'converting',
  10480. fn: function (){
  10481. var self=this;
  10482. return smalltalk.withContext(function($ctx1) { var $1;
  10483. $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){
  10484. return smalltalk.withContext(function($ctx2) { return _st(each)._asJavascript();
  10485. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
  10486. return $1;
  10487. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Array)})},
  10488. args: [],
  10489. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  10490. messageSends: [",", "join:", "collect:", "asJavascript"],
  10491. referencedClasses: []
  10492. }),
  10493. smalltalk.Array);
  10494. smalltalk.addMethod(
  10495. "_at_ifAbsent_",
  10496. smalltalk.method({
  10497. selector: "at:ifAbsent:",
  10498. category: 'accessing',
  10499. fn: function (anIndex,aBlock){
  10500. var self=this;
  10501. return smalltalk.withContext(function($ctx1) {
  10502. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  10503. return self[anIndex - 1];
  10504. ;
  10505. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Array)})},
  10506. args: ["anIndex", "aBlock"],
  10507. 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>",
  10508. messageSends: [],
  10509. referencedClasses: []
  10510. }),
  10511. smalltalk.Array);
  10512. smalltalk.addMethod(
  10513. "_at_put_",
  10514. smalltalk.method({
  10515. selector: "at:put:",
  10516. category: 'accessing',
  10517. fn: function (anIndex,anObject){
  10518. var self=this;
  10519. return smalltalk.withContext(function($ctx1) { return self[anIndex - 1] = anObject;
  10520. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.Array)})},
  10521. args: ["anIndex", "anObject"],
  10522. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  10523. messageSends: [],
  10524. referencedClasses: []
  10525. }),
  10526. smalltalk.Array);
  10527. smalltalk.addMethod(
  10528. "_join_",
  10529. smalltalk.method({
  10530. selector: "join:",
  10531. category: 'enumerating',
  10532. fn: function (aString){
  10533. var self=this;
  10534. return smalltalk.withContext(function($ctx1) { return self.join(aString);
  10535. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString}, smalltalk.Array)})},
  10536. args: ["aString"],
  10537. source: "join: aString\x0a\x09<return self.join(aString)>",
  10538. messageSends: [],
  10539. referencedClasses: []
  10540. }),
  10541. smalltalk.Array);
  10542. smalltalk.addMethod(
  10543. "_remove_ifAbsent_",
  10544. smalltalk.method({
  10545. selector: "remove:ifAbsent:",
  10546. category: 'adding/removing',
  10547. fn: function (anObject,aBlock){
  10548. var self=this;
  10549. return smalltalk.withContext(function($ctx1) {
  10550. for(var i=0;i<self.length;i++) {
  10551. if(self[i] == anObject) {
  10552. self.splice(i,1);
  10553. return self;
  10554. }
  10555. };
  10556. aBlock._value();
  10557. ;
  10558. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Array)})},
  10559. args: ["anObject", "aBlock"],
  10560. 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 aBlock._value();\x0a\x09>",
  10561. messageSends: [],
  10562. referencedClasses: []
  10563. }),
  10564. smalltalk.Array);
  10565. smalltalk.addMethod(
  10566. "_removeFrom_to_",
  10567. smalltalk.method({
  10568. selector: "removeFrom:to:",
  10569. category: 'adding/removing',
  10570. fn: function (aNumber,anotherNumber){
  10571. var self=this;
  10572. return smalltalk.withContext(function($ctx1) { self.splice(aNumber - 1,anotherNumber - 1);
  10573. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber}, smalltalk.Array)})},
  10574. args: ["aNumber", "anotherNumber"],
  10575. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  10576. messageSends: [],
  10577. referencedClasses: []
  10578. }),
  10579. smalltalk.Array);
  10580. smalltalk.addMethod(
  10581. "_reversed",
  10582. smalltalk.method({
  10583. selector: "reversed",
  10584. category: 'converting',
  10585. fn: function (){
  10586. var self=this;
  10587. return smalltalk.withContext(function($ctx1) { return self._copy().reverse();
  10588. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.Array)})},
  10589. args: [],
  10590. source: "reversed\x0a\x09<return self._copy().reverse()>",
  10591. messageSends: [],
  10592. referencedClasses: []
  10593. }),
  10594. smalltalk.Array);
  10595. smalltalk.addMethod(
  10596. "_size",
  10597. smalltalk.method({
  10598. selector: "size",
  10599. category: 'accessing',
  10600. fn: function (){
  10601. var self=this;
  10602. return smalltalk.withContext(function($ctx1) { return self.length;
  10603. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Array)})},
  10604. args: [],
  10605. source: "size\x0a\x09<return self.length>",
  10606. messageSends: [],
  10607. referencedClasses: []
  10608. }),
  10609. smalltalk.Array);
  10610. smalltalk.addMethod(
  10611. "_sort",
  10612. smalltalk.method({
  10613. selector: "sort",
  10614. category: 'enumerating',
  10615. fn: function (){
  10616. var self=this;
  10617. return smalltalk.withContext(function($ctx1) { var $1;
  10618. $1=_st(self)._basicPerform_("sort");
  10619. return $1;
  10620. }, function($ctx1) {$ctx1.fill(self,"sort",{}, smalltalk.Array)})},
  10621. args: [],
  10622. source: "sort\x0a ^self basicPerform: 'sort'",
  10623. messageSends: ["basicPerform:"],
  10624. referencedClasses: []
  10625. }),
  10626. smalltalk.Array);
  10627. smalltalk.addMethod(
  10628. "_sort_",
  10629. smalltalk.method({
  10630. selector: "sort:",
  10631. category: 'enumerating',
  10632. fn: function (aBlock){
  10633. var self=this;
  10634. return smalltalk.withContext(function($ctx1) {
  10635. return self.sort(function(a, b) {
  10636. if(aBlock(a,b)) {return -1} else {return 1}
  10637. })
  10638. ;
  10639. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock}, smalltalk.Array)})},
  10640. args: ["aBlock"],
  10641. 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>",
  10642. messageSends: [],
  10643. referencedClasses: []
  10644. }),
  10645. smalltalk.Array);
  10646. smalltalk.addMethod(
  10647. "_sorted",
  10648. smalltalk.method({
  10649. selector: "sorted",
  10650. category: 'enumerating',
  10651. fn: function (){
  10652. var self=this;
  10653. return smalltalk.withContext(function($ctx1) { var $1;
  10654. $1=_st(_st(self)._copy())._sort();
  10655. return $1;
  10656. }, function($ctx1) {$ctx1.fill(self,"sorted",{}, smalltalk.Array)})},
  10657. args: [],
  10658. source: "sorted\x0a\x09^self copy sort",
  10659. messageSends: ["sort", "copy"],
  10660. referencedClasses: []
  10661. }),
  10662. smalltalk.Array);
  10663. smalltalk.addMethod(
  10664. "_sorted_",
  10665. smalltalk.method({
  10666. selector: "sorted:",
  10667. category: 'enumerating',
  10668. fn: function (aBlock){
  10669. var self=this;
  10670. return smalltalk.withContext(function($ctx1) { var $1;
  10671. $1=_st(_st(self)._copy())._sort_(aBlock);
  10672. return $1;
  10673. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock}, smalltalk.Array)})},
  10674. args: ["aBlock"],
  10675. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  10676. messageSends: ["sort:", "copy"],
  10677. referencedClasses: []
  10678. }),
  10679. smalltalk.Array);
  10680. smalltalk.addMethod(
  10681. "_new_",
  10682. smalltalk.method({
  10683. selector: "new:",
  10684. category: 'instance creation',
  10685. fn: function (anInteger){
  10686. var self=this;
  10687. return smalltalk.withContext(function($ctx1) { return new Array(anInteger);
  10688. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Array.klass)})},
  10689. args: ["anInteger"],
  10690. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  10691. messageSends: [],
  10692. referencedClasses: []
  10693. }),
  10694. smalltalk.Array.klass);
  10695. smalltalk.addMethod(
  10696. "_with_",
  10697. smalltalk.method({
  10698. selector: "with:",
  10699. category: 'instance creation',
  10700. fn: function (anObject){
  10701. var self=this;
  10702. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  10703. $2=_st(self)._new_((1));
  10704. _st($2)._at_put_((1),anObject);
  10705. $3=_st($2)._yourself();
  10706. $1=$3;
  10707. return $1;
  10708. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Array.klass)})},
  10709. args: ["anObject"],
  10710. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10711. messageSends: ["at:put:", "new:", "yourself"],
  10712. referencedClasses: []
  10713. }),
  10714. smalltalk.Array.klass);
  10715. smalltalk.addMethod(
  10716. "_with_with_",
  10717. smalltalk.method({
  10718. selector: "with:with:",
  10719. category: 'instance creation',
  10720. fn: function (anObject,anObject2){
  10721. var self=this;
  10722. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  10723. $2=_st(self)._new_((2));
  10724. _st($2)._at_put_((1),anObject);
  10725. _st($2)._at_put_((2),anObject2);
  10726. $3=_st($2)._yourself();
  10727. $1=$3;
  10728. return $1;
  10729. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2}, smalltalk.Array.klass)})},
  10730. args: ["anObject", "anObject2"],
  10731. source: "with: anObject with: anObject2\x0a\x09 ^(self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  10732. messageSends: ["at:put:", "new:", "yourself"],
  10733. referencedClasses: []
  10734. }),
  10735. smalltalk.Array.klass);
  10736. smalltalk.addMethod(
  10737. "_with_with_with_",
  10738. smalltalk.method({
  10739. selector: "with:with:with:",
  10740. category: 'instance creation',
  10741. fn: function (anObject,anObject2,anObject3){
  10742. var self=this;
  10743. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  10744. $2=_st(self)._new_((3));
  10745. _st($2)._at_put_((1),anObject);
  10746. _st($2)._at_put_((2),anObject2);
  10747. _st($2)._at_put_((3),anObject3);
  10748. $3=_st($2)._yourself();
  10749. $1=$3;
  10750. return $1;
  10751. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.Array.klass)})},
  10752. args: ["anObject", "anObject2", "anObject3"],
  10753. source: "with: anObject with: anObject2 with: anObject3\x0a\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",
  10754. messageSends: ["at:put:", "new:", "yourself"],
  10755. referencedClasses: []
  10756. }),
  10757. smalltalk.Array.klass);
  10758. smalltalk.addMethod(
  10759. "_withAll_",
  10760. smalltalk.method({
  10761. selector: "withAll:",
  10762. category: 'instance creation',
  10763. fn: function (aCollection){
  10764. var self=this;
  10765. var instance,index;
  10766. return smalltalk.withContext(function($ctx1) { var $1;
  10767. index=(1);
  10768. instance=_st(self)._new_(_st(aCollection)._size());
  10769. _st(aCollection)._do_((function(each){
  10770. return smalltalk.withContext(function($ctx2) { _st(instance)._at_put_(index,each);
  10771. index=_st(index).__plus((1));
  10772. return index;
  10773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10774. $1=instance;
  10775. return $1;
  10776. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index}, smalltalk.Array.klass)})},
  10777. args: ["aCollection"],
  10778. 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",
  10779. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  10780. referencedClasses: []
  10781. }),
  10782. smalltalk.Array.klass);
  10783. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  10784. smalltalk.addMethod(
  10785. "__comma",
  10786. smalltalk.method({
  10787. selector: ",",
  10788. category: 'copying',
  10789. fn: function (aString){
  10790. var self=this;
  10791. return smalltalk.withContext(function($ctx1) { var $1;
  10792. $1=_st(_st(self)._asString()).__comma(_st(aString)._asString());
  10793. return $1;
  10794. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.CharacterArray)})},
  10795. args: ["aString"],
  10796. source: ", aString\x0a\x09^self asString, aString asString",
  10797. messageSends: [",", "asString"],
  10798. referencedClasses: []
  10799. }),
  10800. smalltalk.CharacterArray);
  10801. smalltalk.addMethod(
  10802. "_add_",
  10803. smalltalk.method({
  10804. selector: "add:",
  10805. category: 'adding',
  10806. fn: function (anObject){
  10807. var self=this;
  10808. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  10809. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.CharacterArray)})},
  10810. args: ["anObject"],
  10811. source: "add: anObject\x0a\x09self errorReadOnly",
  10812. messageSends: ["errorReadOnly"],
  10813. referencedClasses: []
  10814. }),
  10815. smalltalk.CharacterArray);
  10816. smalltalk.addMethod(
  10817. "_asLowercase",
  10818. smalltalk.method({
  10819. selector: "asLowercase",
  10820. category: 'converting',
  10821. fn: function (){
  10822. var self=this;
  10823. return smalltalk.withContext(function($ctx1) { var $1;
  10824. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asLowercase());
  10825. return $1;
  10826. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.CharacterArray)})},
  10827. args: [],
  10828. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  10829. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  10830. referencedClasses: []
  10831. }),
  10832. smalltalk.CharacterArray);
  10833. smalltalk.addMethod(
  10834. "_asNumber",
  10835. smalltalk.method({
  10836. selector: "asNumber",
  10837. category: 'converting',
  10838. fn: function (){
  10839. var self=this;
  10840. return smalltalk.withContext(function($ctx1) { var $1;
  10841. $1=_st(_st(self)._asString())._asNumber();
  10842. return $1;
  10843. }, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.CharacterArray)})},
  10844. args: [],
  10845. source: "asNumber\x0a\x09^self asString asNumber",
  10846. messageSends: ["asNumber", "asString"],
  10847. referencedClasses: []
  10848. }),
  10849. smalltalk.CharacterArray);
  10850. smalltalk.addMethod(
  10851. "_asString",
  10852. smalltalk.method({
  10853. selector: "asString",
  10854. category: 'converting',
  10855. fn: function (){
  10856. var self=this;
  10857. return smalltalk.withContext(function($ctx1) { var $1;
  10858. $1=_st(self)._subclassResponsibility();
  10859. return $1;
  10860. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.CharacterArray)})},
  10861. args: [],
  10862. source: "asString\x0a\x09^self subclassResponsibility",
  10863. messageSends: ["subclassResponsibility"],
  10864. referencedClasses: []
  10865. }),
  10866. smalltalk.CharacterArray);
  10867. smalltalk.addMethod(
  10868. "_asSymbol",
  10869. smalltalk.method({
  10870. selector: "asSymbol",
  10871. category: 'converting',
  10872. fn: function (){
  10873. var self=this;
  10874. return smalltalk.withContext(function($ctx1) { var $1;
  10875. $1=_st(self)._subclassResponsibility();
  10876. return $1;
  10877. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.CharacterArray)})},
  10878. args: [],
  10879. source: "asSymbol\x0a\x09^self subclassResponsibility",
  10880. messageSends: ["subclassResponsibility"],
  10881. referencedClasses: []
  10882. }),
  10883. smalltalk.CharacterArray);
  10884. smalltalk.addMethod(
  10885. "_asUppercase",
  10886. smalltalk.method({
  10887. selector: "asUppercase",
  10888. category: 'converting',
  10889. fn: function (){
  10890. var self=this;
  10891. return smalltalk.withContext(function($ctx1) { var $1;
  10892. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asUppercase());
  10893. return $1;
  10894. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.CharacterArray)})},
  10895. args: [],
  10896. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  10897. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  10898. referencedClasses: []
  10899. }),
  10900. smalltalk.CharacterArray);
  10901. smalltalk.addMethod(
  10902. "_at_put_",
  10903. smalltalk.method({
  10904. selector: "at:put:",
  10905. category: 'accessing',
  10906. fn: function (anIndex,anObject){
  10907. var self=this;
  10908. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  10909. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.CharacterArray)})},
  10910. args: ["anIndex", "anObject"],
  10911. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  10912. messageSends: ["errorReadOnly"],
  10913. referencedClasses: []
  10914. }),
  10915. smalltalk.CharacterArray);
  10916. smalltalk.addMethod(
  10917. "_errorReadOnly",
  10918. smalltalk.method({
  10919. selector: "errorReadOnly",
  10920. category: 'error handling',
  10921. fn: function (){
  10922. var self=this;
  10923. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is read-only");
  10924. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{}, smalltalk.CharacterArray)})},
  10925. args: [],
  10926. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  10927. messageSends: ["error:"],
  10928. referencedClasses: []
  10929. }),
  10930. smalltalk.CharacterArray);
  10931. smalltalk.addMethod(
  10932. "_printString",
  10933. smalltalk.method({
  10934. selector: "printString",
  10935. category: 'printing',
  10936. fn: function (){
  10937. var self=this;
  10938. return smalltalk.withContext(function($ctx1) { var $1;
  10939. $1=_st(_st(self)._asString())._printString();
  10940. return $1;
  10941. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.CharacterArray)})},
  10942. args: [],
  10943. source: "printString\x0a\x09^self asString printString",
  10944. messageSends: ["printString", "asString"],
  10945. referencedClasses: []
  10946. }),
  10947. smalltalk.CharacterArray);
  10948. smalltalk.addMethod(
  10949. "_remove_",
  10950. smalltalk.method({
  10951. selector: "remove:",
  10952. category: 'adding',
  10953. fn: function (anObject){
  10954. var self=this;
  10955. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  10956. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.CharacterArray)})},
  10957. args: ["anObject"],
  10958. source: "remove: anObject\x0a\x09self errorReadOnly",
  10959. messageSends: ["errorReadOnly"],
  10960. referencedClasses: []
  10961. }),
  10962. smalltalk.CharacterArray);
  10963. smalltalk.addMethod(
  10964. "_fromString_",
  10965. smalltalk.method({
  10966. selector: "fromString:",
  10967. category: 'instance creation',
  10968. fn: function (aString){
  10969. var self=this;
  10970. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  10971. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.CharacterArray.klass)})},
  10972. args: ["aString"],
  10973. source: "fromString: aString\x0a\x09self subclassResponsibility",
  10974. messageSends: ["subclassResponsibility"],
  10975. referencedClasses: []
  10976. }),
  10977. smalltalk.CharacterArray.klass);
  10978. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  10979. smalltalk.addMethod(
  10980. "__comma",
  10981. smalltalk.method({
  10982. selector: ",",
  10983. category: 'copying',
  10984. fn: function (aString){
  10985. var self=this;
  10986. return smalltalk.withContext(function($ctx1) { return self + aString;
  10987. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.String)})},
  10988. args: ["aString"],
  10989. source: ", aString\x0a\x09<return self + aString>",
  10990. messageSends: [],
  10991. referencedClasses: []
  10992. }),
  10993. smalltalk.String);
  10994. smalltalk.addMethod(
  10995. "__lt",
  10996. smalltalk.method({
  10997. selector: "<",
  10998. category: 'comparing',
  10999. fn: function (aString){
  11000. var self=this;
  11001. return smalltalk.withContext(function($ctx1) { return String(self) < aString._asString();
  11002. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString}, smalltalk.String)})},
  11003. args: ["aString"],
  11004. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  11005. messageSends: [],
  11006. referencedClasses: []
  11007. }),
  11008. smalltalk.String);
  11009. smalltalk.addMethod(
  11010. "__lt_eq",
  11011. smalltalk.method({
  11012. selector: "<=",
  11013. category: 'comparing',
  11014. fn: function (aString){
  11015. var self=this;
  11016. return smalltalk.withContext(function($ctx1) { return String(self) <= aString._asString();
  11017. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString}, smalltalk.String)})},
  11018. args: ["aString"],
  11019. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  11020. messageSends: [],
  11021. referencedClasses: []
  11022. }),
  11023. smalltalk.String);
  11024. smalltalk.addMethod(
  11025. "__eq",
  11026. smalltalk.method({
  11027. selector: "=",
  11028. category: 'comparing',
  11029. fn: function (aString){
  11030. var self=this;
  11031. return smalltalk.withContext(function($ctx1) {
  11032. if(! aString._isString || ! aString._isString()) {
  11033. return false;
  11034. }
  11035. return String(self) === String(aString)
  11036. ;
  11037. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString}, smalltalk.String)})},
  11038. args: ["aString"],
  11039. source: "= aString\x0a\x09<\x0a \x09if(! aString._isString || ! aString._isString()) {\x0a \x09return false;\x0a }\x0a \x09return String(self) === String(aString)\x0a >",
  11040. messageSends: [],
  11041. referencedClasses: []
  11042. }),
  11043. smalltalk.String);
  11044. smalltalk.addMethod(
  11045. "__eq_eq",
  11046. smalltalk.method({
  11047. selector: "==",
  11048. category: 'comparing',
  11049. fn: function (aString){
  11050. var self=this;
  11051. return smalltalk.withContext(function($ctx1) { var $1;
  11052. $1=_st(self).__eq(aString);
  11053. return $1;
  11054. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString}, smalltalk.String)})},
  11055. args: ["aString"],
  11056. source: "== aString\x0a\x09^self = aString",
  11057. messageSends: ["="],
  11058. referencedClasses: []
  11059. }),
  11060. smalltalk.String);
  11061. smalltalk.addMethod(
  11062. "__gt",
  11063. smalltalk.method({
  11064. selector: ">",
  11065. category: 'comparing',
  11066. fn: function (aString){
  11067. var self=this;
  11068. return smalltalk.withContext(function($ctx1) { return String(self) > aString._asString();
  11069. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString}, smalltalk.String)})},
  11070. args: ["aString"],
  11071. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  11072. messageSends: [],
  11073. referencedClasses: []
  11074. }),
  11075. smalltalk.String);
  11076. smalltalk.addMethod(
  11077. "__gt_eq",
  11078. smalltalk.method({
  11079. selector: ">=",
  11080. category: 'comparing',
  11081. fn: function (aString){
  11082. var self=this;
  11083. return smalltalk.withContext(function($ctx1) { return String(self) >= aString._asString();
  11084. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString}, smalltalk.String)})},
  11085. args: ["aString"],
  11086. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  11087. messageSends: [],
  11088. referencedClasses: []
  11089. }),
  11090. smalltalk.String);
  11091. smalltalk.addMethod(
  11092. "_asJSON",
  11093. smalltalk.method({
  11094. selector: "asJSON",
  11095. category: 'converting',
  11096. fn: function (){
  11097. var self=this;
  11098. return smalltalk.withContext(function($ctx1) { var $1;
  11099. $1=self;
  11100. return $1;
  11101. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.String)})},
  11102. args: [],
  11103. source: "asJSON\x0a\x09^self",
  11104. messageSends: [],
  11105. referencedClasses: []
  11106. }),
  11107. smalltalk.String);
  11108. smalltalk.addMethod(
  11109. "_asJavaScriptSelector",
  11110. smalltalk.method({
  11111. selector: "asJavaScriptSelector",
  11112. category: 'converting',
  11113. fn: function (){
  11114. var self=this;
  11115. return smalltalk.withContext(function($ctx1) { var $1;
  11116. $1=_st(_st(_st(self)._asSelector())._replace_with_("^_",""))._replace_with_("_.*","");
  11117. return $1;
  11118. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{}, smalltalk.String)})},
  11119. args: [],
  11120. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  11121. messageSends: ["replace:with:", "asSelector"],
  11122. referencedClasses: []
  11123. }),
  11124. smalltalk.String);
  11125. smalltalk.addMethod(
  11126. "_asJavascript",
  11127. smalltalk.method({
  11128. selector: "asJavascript",
  11129. category: 'converting',
  11130. fn: function (){
  11131. var self=this;
  11132. return smalltalk.withContext(function($ctx1) {
  11133. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11134. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11135. else
  11136. return "\"" + self + "\"";
  11137. ;
  11138. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.String)})},
  11139. args: [],
  11140. 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>",
  11141. messageSends: [],
  11142. referencedClasses: []
  11143. }),
  11144. smalltalk.String);
  11145. smalltalk.addMethod(
  11146. "_asLowercase",
  11147. smalltalk.method({
  11148. selector: "asLowercase",
  11149. category: 'converting',
  11150. fn: function (){
  11151. var self=this;
  11152. return smalltalk.withContext(function($ctx1) { return self.toLowerCase();
  11153. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.String)})},
  11154. args: [],
  11155. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  11156. messageSends: [],
  11157. referencedClasses: []
  11158. }),
  11159. smalltalk.String);
  11160. smalltalk.addMethod(
  11161. "_asNumber",
  11162. smalltalk.method({
  11163. selector: "asNumber",
  11164. category: 'converting',
  11165. fn: function (){
  11166. var self=this;
  11167. return smalltalk.withContext(function($ctx1) { return Number(self);
  11168. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.String)})},
  11169. args: [],
  11170. source: "asNumber\x0a\x09<return Number(self)>",
  11171. messageSends: [],
  11172. referencedClasses: []
  11173. }),
  11174. smalltalk.String);
  11175. smalltalk.addMethod(
  11176. "_asRegexp",
  11177. smalltalk.method({
  11178. selector: "asRegexp",
  11179. category: 'converting',
  11180. fn: function (){
  11181. var self=this;
  11182. return smalltalk.withContext(function($ctx1) { var $1;
  11183. $1=_st((smalltalk.RegularExpression || RegularExpression))._fromString_(self);
  11184. return $1;
  11185. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{}, smalltalk.String)})},
  11186. args: [],
  11187. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11188. messageSends: ["fromString:"],
  11189. referencedClasses: ["RegularExpression"]
  11190. }),
  11191. smalltalk.String);
  11192. smalltalk.addMethod(
  11193. "_asSelector",
  11194. smalltalk.method({
  11195. selector: "asSelector",
  11196. category: 'converting',
  11197. fn: function (){
  11198. var self=this;
  11199. return smalltalk.withContext(function($ctx1) { return smalltalk.selector(self);
  11200. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.String)})},
  11201. args: [],
  11202. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  11203. messageSends: [],
  11204. referencedClasses: []
  11205. }),
  11206. smalltalk.String);
  11207. smalltalk.addMethod(
  11208. "_asString",
  11209. smalltalk.method({
  11210. selector: "asString",
  11211. category: 'converting',
  11212. fn: function (){
  11213. var self=this;
  11214. return smalltalk.withContext(function($ctx1) { var $1;
  11215. $1=self;
  11216. return $1;
  11217. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.String)})},
  11218. args: [],
  11219. source: "asString\x0a\x09^self",
  11220. messageSends: [],
  11221. referencedClasses: []
  11222. }),
  11223. smalltalk.String);
  11224. smalltalk.addMethod(
  11225. "_asSymbol",
  11226. smalltalk.method({
  11227. selector: "asSymbol",
  11228. category: 'converting',
  11229. fn: function (){
  11230. var self=this;
  11231. return smalltalk.withContext(function($ctx1) { var $1;
  11232. $1=_st((smalltalk.Symbol || Symbol))._lookup_(self);
  11233. return $1;
  11234. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.String)})},
  11235. args: [],
  11236. source: "asSymbol\x0a\x09^Symbol lookup: self",
  11237. messageSends: ["lookup:"],
  11238. referencedClasses: ["Symbol"]
  11239. }),
  11240. smalltalk.String);
  11241. smalltalk.addMethod(
  11242. "_asUppercase",
  11243. smalltalk.method({
  11244. selector: "asUppercase",
  11245. category: 'converting',
  11246. fn: function (){
  11247. var self=this;
  11248. return smalltalk.withContext(function($ctx1) { return self.toUpperCase();
  11249. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.String)})},
  11250. args: [],
  11251. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  11252. messageSends: [],
  11253. referencedClasses: []
  11254. }),
  11255. smalltalk.String);
  11256. smalltalk.addMethod(
  11257. "_asciiValue",
  11258. smalltalk.method({
  11259. selector: "asciiValue",
  11260. category: 'accessing',
  11261. fn: function (){
  11262. var self=this;
  11263. return smalltalk.withContext(function($ctx1) { return self.charCodeAt(0);;
  11264. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{}, smalltalk.String)})},
  11265. args: [],
  11266. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  11267. messageSends: [],
  11268. referencedClasses: []
  11269. }),
  11270. smalltalk.String);
  11271. smalltalk.addMethod(
  11272. "_at_ifAbsent_",
  11273. smalltalk.method({
  11274. selector: "at:ifAbsent:",
  11275. category: 'accessing',
  11276. fn: function (anIndex,aBlock){
  11277. var self=this;
  11278. return smalltalk.withContext(function($ctx1) { return String(self).charAt(anIndex - 1) || aBlock();
  11279. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.String)})},
  11280. args: ["anIndex", "aBlock"],
  11281. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  11282. messageSends: [],
  11283. referencedClasses: []
  11284. }),
  11285. smalltalk.String);
  11286. smalltalk.addMethod(
  11287. "_copyFrom_to_",
  11288. smalltalk.method({
  11289. selector: "copyFrom:to:",
  11290. category: 'copying',
  11291. fn: function (anIndex,anotherIndex){
  11292. var self=this;
  11293. return smalltalk.withContext(function($ctx1) { return self.substring(anIndex - 1, anotherIndex);
  11294. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.String)})},
  11295. args: ["anIndex", "anotherIndex"],
  11296. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  11297. messageSends: [],
  11298. referencedClasses: []
  11299. }),
  11300. smalltalk.String);
  11301. smalltalk.addMethod(
  11302. "_deepCopy",
  11303. smalltalk.method({
  11304. selector: "deepCopy",
  11305. category: 'copying',
  11306. fn: function (){
  11307. var self=this;
  11308. return smalltalk.withContext(function($ctx1) { var $1;
  11309. $1=_st(self)._shallowCopy();
  11310. return $1;
  11311. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.String)})},
  11312. args: [],
  11313. source: "deepCopy\x0a\x09^self shallowCopy",
  11314. messageSends: ["shallowCopy"],
  11315. referencedClasses: []
  11316. }),
  11317. smalltalk.String);
  11318. smalltalk.addMethod(
  11319. "_do_",
  11320. smalltalk.method({
  11321. selector: "do:",
  11322. category: 'enumerating',
  11323. fn: function (aBlock){
  11324. var self=this;
  11325. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  11326. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.String)})},
  11327. args: ["aBlock"],
  11328. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  11329. messageSends: [],
  11330. referencedClasses: []
  11331. }),
  11332. smalltalk.String);
  11333. smalltalk.addMethod(
  11334. "_escaped",
  11335. smalltalk.method({
  11336. selector: "escaped",
  11337. category: 'accessing',
  11338. fn: function (){
  11339. var self=this;
  11340. return smalltalk.withContext(function($ctx1) { return escape(self);
  11341. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{}, smalltalk.String)})},
  11342. args: [],
  11343. source: "escaped\x0a\x09<return escape(self)>",
  11344. messageSends: [],
  11345. referencedClasses: []
  11346. }),
  11347. smalltalk.String);
  11348. smalltalk.addMethod(
  11349. "_includesSubString_",
  11350. smalltalk.method({
  11351. selector: "includesSubString:",
  11352. category: 'testing',
  11353. fn: function (subString){
  11354. var self=this;
  11355. return smalltalk.withContext(function($ctx1) { return self.indexOf(subString) != -1 ;
  11356. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString}, smalltalk.String)})},
  11357. args: ["subString"],
  11358. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  11359. messageSends: [],
  11360. referencedClasses: []
  11361. }),
  11362. smalltalk.String);
  11363. smalltalk.addMethod(
  11364. "_isString",
  11365. smalltalk.method({
  11366. selector: "isString",
  11367. category: 'testing',
  11368. fn: function (){
  11369. var self=this;
  11370. return smalltalk.withContext(function($ctx1) { return true;
  11371. }, function($ctx1) {$ctx1.fill(self,"isString",{}, smalltalk.String)})},
  11372. args: [],
  11373. source: "isString\x0a\x09^true",
  11374. messageSends: [],
  11375. referencedClasses: []
  11376. }),
  11377. smalltalk.String);
  11378. smalltalk.addMethod(
  11379. "_join_",
  11380. smalltalk.method({
  11381. selector: "join:",
  11382. category: 'split join',
  11383. fn: function (aCollection){
  11384. var self=this;
  11385. return smalltalk.withContext(function($ctx1) { var $1;
  11386. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  11387. return smalltalk.withContext(function($ctx2) { return _st(aCollection)._do_separatedBy_((function(each){
  11388. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(_st(each)._asString());
  11389. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  11390. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(self);
  11391. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  11392. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  11393. return $1;
  11394. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection}, smalltalk.String)})},
  11395. args: ["aCollection"],
  11396. 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]]",
  11397. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  11398. referencedClasses: ["String"]
  11399. }),
  11400. smalltalk.String);
  11401. smalltalk.addMethod(
  11402. "_lineIndicesDo_",
  11403. smalltalk.method({
  11404. selector: "lineIndicesDo:",
  11405. category: 'split join',
  11406. fn: function (aBlock){
  11407. var self=this;
  11408. var cr,lf,start,sz,nextLF,nextCR;
  11409. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  11410. var $early={};
  11411. try {
  11412. start=(1);
  11413. sz=_st(self)._size();
  11414. cr=_st((smalltalk.String || String))._cr();
  11415. nextCR=_st(self)._indexOf_startingAt_(cr,(1));
  11416. lf=_st((smalltalk.String || String))._lf();
  11417. nextLF=_st(self)._indexOf_startingAt_(lf,(1));
  11418. _st((function(){
  11419. return smalltalk.withContext(function($ctx2) { return _st(start).__lt_eq(sz);
  11420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  11421. return smalltalk.withContext(function($ctx2) { $1=_st(_st(nextLF).__eq((0)))._and_((function(){
  11422. return smalltalk.withContext(function($ctx3) { return _st(nextCR).__eq((0));
  11423. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  11424. if(smalltalk.assert($1)){
  11425. _st(aBlock)._value_value_value_(start,sz,sz);
  11426. $2=self;
  11427. throw $early=[$2];
  11428. };
  11429. $3=_st(_st(nextCR).__eq((0)))._or_((function(){
  11430. return smalltalk.withContext(function($ctx3) { return _st(_st((0)).__lt(nextLF))._and_((function(){
  11431. return smalltalk.withContext(function($ctx4) { return _st(nextLF).__lt(nextCR);
  11432. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  11433. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  11434. if(smalltalk.assert($3)){
  11435. _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  11436. start=_st((1)).__plus(nextLF);
  11437. start;
  11438. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  11439. return nextLF;
  11440. } else {
  11441. $4=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
  11442. if(smalltalk.assert($4)){
  11443. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  11444. start=_st((1)).__plus(nextLF);
  11445. start;
  11446. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  11447. nextCR;
  11448. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  11449. return nextLF;
  11450. } else {
  11451. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  11452. start=_st((1)).__plus(nextCR);
  11453. start;
  11454. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  11455. return nextCR;
  11456. };
  11457. };
  11458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11459. return self}
  11460. catch(e) {if(e===$early)return e[0]; throw e}
  11461. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR}, smalltalk.String)})},
  11462. args: ["aBlock"],
  11463. 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 ]]]",
  11464. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  11465. referencedClasses: ["String"]
  11466. }),
  11467. smalltalk.String);
  11468. smalltalk.addMethod(
  11469. "_lineNumber_",
  11470. smalltalk.method({
  11471. selector: "lineNumber:",
  11472. category: 'split join',
  11473. fn: function (anIndex){
  11474. var self=this;
  11475. var lineCount;
  11476. return smalltalk.withContext(function($ctx1) { var $1,$2;
  11477. var $early={};
  11478. try {
  11479. lineCount=(0);
  11480. _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11481. return smalltalk.withContext(function($ctx2) { lineCount=_st(lineCount).__plus((1));
  11482. $1=_st(lineCount).__eq(anIndex);
  11483. if(smalltalk.assert($1)){
  11484. $2=_st(self)._copyFrom_to_(start,endWithoutDelimiters);
  11485. throw $early=[$2];
  11486. };
  11487. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  11488. return nil;
  11489. }
  11490. catch(e) {if(e===$early)return e[0]; throw e}
  11491. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount}, smalltalk.String)})},
  11492. args: ["anIndex"],
  11493. 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",
  11494. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  11495. referencedClasses: []
  11496. }),
  11497. smalltalk.String);
  11498. smalltalk.addMethod(
  11499. "_lines",
  11500. smalltalk.method({
  11501. selector: "lines",
  11502. category: 'split join',
  11503. fn: function (){
  11504. var self=this;
  11505. var lines;
  11506. return smalltalk.withContext(function($ctx1) { var $1;
  11507. lines=_st((smalltalk.Array || Array))._new();
  11508. _st(self)._linesDo_((function(aLine){
  11509. return smalltalk.withContext(function($ctx2) { return _st(lines)._add_(aLine);
  11510. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  11511. $1=lines;
  11512. return $1;
  11513. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines}, smalltalk.String)})},
  11514. args: [],
  11515. 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",
  11516. messageSends: ["new", "linesDo:", "add:"],
  11517. referencedClasses: ["Array"]
  11518. }),
  11519. smalltalk.String);
  11520. smalltalk.addMethod(
  11521. "_linesDo_",
  11522. smalltalk.method({
  11523. selector: "linesDo:",
  11524. category: 'split join',
  11525. fn: function (aBlock){
  11526. var self=this;
  11527. return smalltalk.withContext(function($ctx1) { _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11528. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters));
  11529. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  11530. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock}, smalltalk.String)})},
  11531. args: ["aBlock"],
  11532. 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)]",
  11533. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  11534. referencedClasses: []
  11535. }),
  11536. smalltalk.String);
  11537. smalltalk.addMethod(
  11538. "_match_",
  11539. smalltalk.method({
  11540. selector: "match:",
  11541. category: 'regular expressions',
  11542. fn: function (aRegexp){
  11543. var self=this;
  11544. return smalltalk.withContext(function($ctx1) { return self.search(aRegexp) != -1;
  11545. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp}, smalltalk.String)})},
  11546. args: ["aRegexp"],
  11547. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  11548. messageSends: [],
  11549. referencedClasses: []
  11550. }),
  11551. smalltalk.String);
  11552. smalltalk.addMethod(
  11553. "_matchesOf_",
  11554. smalltalk.method({
  11555. selector: "matchesOf:",
  11556. category: 'regular expressions',
  11557. fn: function (aRegularExpression){
  11558. var self=this;
  11559. return smalltalk.withContext(function($ctx1) { return self.match(aRegularExpression);
  11560. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression}, smalltalk.String)})},
  11561. args: ["aRegularExpression"],
  11562. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  11563. messageSends: [],
  11564. referencedClasses: []
  11565. }),
  11566. smalltalk.String);
  11567. smalltalk.addMethod(
  11568. "_printNl",
  11569. smalltalk.method({
  11570. selector: "printNl",
  11571. category: 'printing',
  11572. fn: function (){
  11573. var self=this;
  11574. return smalltalk.withContext(function($ctx1) { console.log(self);
  11575. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{}, smalltalk.String)})},
  11576. args: [],
  11577. source: "printNl\x0a\x09<console.log(self)>",
  11578. messageSends: [],
  11579. referencedClasses: []
  11580. }),
  11581. smalltalk.String);
  11582. smalltalk.addMethod(
  11583. "_printString",
  11584. smalltalk.method({
  11585. selector: "printString",
  11586. category: 'printing',
  11587. fn: function (){
  11588. var self=this;
  11589. return smalltalk.withContext(function($ctx1) { var $1;
  11590. $1=_st(_st("'").__comma(self)).__comma("'");
  11591. return $1;
  11592. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.String)})},
  11593. args: [],
  11594. source: "printString\x0a\x09^'''', self, ''''",
  11595. messageSends: [","],
  11596. referencedClasses: []
  11597. }),
  11598. smalltalk.String);
  11599. smalltalk.addMethod(
  11600. "_replace_with_",
  11601. smalltalk.method({
  11602. selector: "replace:with:",
  11603. category: 'regular expressions',
  11604. fn: function (aString,anotherString){
  11605. var self=this;
  11606. return smalltalk.withContext(function($ctx1) { var $1;
  11607. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(aString,"g"),anotherString);
  11608. return $1;
  11609. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString}, smalltalk.String)})},
  11610. args: ["aString", "anotherString"],
  11611. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11612. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  11613. referencedClasses: ["RegularExpression"]
  11614. }),
  11615. smalltalk.String);
  11616. smalltalk.addMethod(
  11617. "_replaceRegexp_with_",
  11618. smalltalk.method({
  11619. selector: "replaceRegexp:with:",
  11620. category: 'regular expressions',
  11621. fn: function (aRegexp,aString){
  11622. var self=this;
  11623. return smalltalk.withContext(function($ctx1) { return self.replace(aRegexp, aString);
  11624. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString}, smalltalk.String)})},
  11625. args: ["aRegexp", "aString"],
  11626. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  11627. messageSends: [],
  11628. referencedClasses: []
  11629. }),
  11630. smalltalk.String);
  11631. smalltalk.addMethod(
  11632. "_reversed",
  11633. smalltalk.method({
  11634. selector: "reversed",
  11635. category: 'converting',
  11636. fn: function (){
  11637. var self=this;
  11638. return smalltalk.withContext(function($ctx1) { return self.split("").reverse().join("");
  11639. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.String)})},
  11640. args: [],
  11641. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  11642. messageSends: [],
  11643. referencedClasses: []
  11644. }),
  11645. smalltalk.String);
  11646. smalltalk.addMethod(
  11647. "_shallowCopy",
  11648. smalltalk.method({
  11649. selector: "shallowCopy",
  11650. category: 'copying',
  11651. fn: function (){
  11652. var self=this;
  11653. return smalltalk.withContext(function($ctx1) { var $1;
  11654. $1=_st(_st(self)._class())._fromString_(self);
  11655. return $1;
  11656. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.String)})},
  11657. args: [],
  11658. source: "shallowCopy\x0a\x09^self class fromString: self",
  11659. messageSends: ["fromString:", "class"],
  11660. referencedClasses: []
  11661. }),
  11662. smalltalk.String);
  11663. smalltalk.addMethod(
  11664. "_size",
  11665. smalltalk.method({
  11666. selector: "size",
  11667. category: 'accessing',
  11668. fn: function (){
  11669. var self=this;
  11670. return smalltalk.withContext(function($ctx1) { return self.length;
  11671. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.String)})},
  11672. args: [],
  11673. source: "size\x0a\x09<return self.length>",
  11674. messageSends: [],
  11675. referencedClasses: []
  11676. }),
  11677. smalltalk.String);
  11678. smalltalk.addMethod(
  11679. "_tokenize_",
  11680. smalltalk.method({
  11681. selector: "tokenize:",
  11682. category: 'converting',
  11683. fn: function (aString){
  11684. var self=this;
  11685. return smalltalk.withContext(function($ctx1) { return self.split(aString);
  11686. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString}, smalltalk.String)})},
  11687. args: ["aString"],
  11688. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  11689. messageSends: [],
  11690. referencedClasses: []
  11691. }),
  11692. smalltalk.String);
  11693. smalltalk.addMethod(
  11694. "_trimBoth",
  11695. smalltalk.method({
  11696. selector: "trimBoth",
  11697. category: 'regular expressions',
  11698. fn: function (){
  11699. var self=this;
  11700. return smalltalk.withContext(function($ctx1) { var $1;
  11701. $1=_st(self)._trimBoth_("\x5cs");
  11702. return $1;
  11703. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{}, smalltalk.String)})},
  11704. args: [],
  11705. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  11706. messageSends: ["trimBoth:"],
  11707. referencedClasses: []
  11708. }),
  11709. smalltalk.String);
  11710. smalltalk.addMethod(
  11711. "_trimBoth_",
  11712. smalltalk.method({
  11713. selector: "trimBoth:",
  11714. category: 'regular expressions',
  11715. fn: function (separators){
  11716. var self=this;
  11717. return smalltalk.withContext(function($ctx1) { var $1;
  11718. $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators);
  11719. return $1;
  11720. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators}, smalltalk.String)})},
  11721. args: ["separators"],
  11722. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  11723. messageSends: ["trimRight:", "trimLeft:"],
  11724. referencedClasses: []
  11725. }),
  11726. smalltalk.String);
  11727. smalltalk.addMethod(
  11728. "_trimLeft",
  11729. smalltalk.method({
  11730. selector: "trimLeft",
  11731. category: 'regular expressions',
  11732. fn: function (){
  11733. var self=this;
  11734. return smalltalk.withContext(function($ctx1) { var $1;
  11735. $1=_st(self)._trimLeft_("\x5cs");
  11736. return $1;
  11737. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{}, smalltalk.String)})},
  11738. args: [],
  11739. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  11740. messageSends: ["trimLeft:"],
  11741. referencedClasses: []
  11742. }),
  11743. smalltalk.String);
  11744. smalltalk.addMethod(
  11745. "_trimLeft_",
  11746. smalltalk.method({
  11747. selector: "trimLeft:",
  11748. category: 'regular expressions',
  11749. fn: function (separators){
  11750. var self=this;
  11751. return smalltalk.withContext(function($ctx1) { var $1;
  11752. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),"");
  11753. return $1;
  11754. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators}, smalltalk.String)})},
  11755. args: ["separators"],
  11756. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11757. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  11758. referencedClasses: ["RegularExpression"]
  11759. }),
  11760. smalltalk.String);
  11761. smalltalk.addMethod(
  11762. "_trimRight",
  11763. smalltalk.method({
  11764. selector: "trimRight",
  11765. category: 'regular expressions',
  11766. fn: function (){
  11767. var self=this;
  11768. return smalltalk.withContext(function($ctx1) { var $1;
  11769. $1=_st(self)._trimRight_("\x5cs");
  11770. return $1;
  11771. }, function($ctx1) {$ctx1.fill(self,"trimRight",{}, smalltalk.String)})},
  11772. args: [],
  11773. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  11774. messageSends: ["trimRight:"],
  11775. referencedClasses: []
  11776. }),
  11777. smalltalk.String);
  11778. smalltalk.addMethod(
  11779. "_trimRight_",
  11780. smalltalk.method({
  11781. selector: "trimRight:",
  11782. category: 'regular expressions',
  11783. fn: function (separators){
  11784. var self=this;
  11785. return smalltalk.withContext(function($ctx1) { var $1;
  11786. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),"");
  11787. return $1;
  11788. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators}, smalltalk.String)})},
  11789. args: ["separators"],
  11790. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11791. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  11792. referencedClasses: ["RegularExpression"]
  11793. }),
  11794. smalltalk.String);
  11795. smalltalk.addMethod(
  11796. "_unescaped",
  11797. smalltalk.method({
  11798. selector: "unescaped",
  11799. category: 'accessing',
  11800. fn: function (){
  11801. var self=this;
  11802. return smalltalk.withContext(function($ctx1) { return unescape(self);
  11803. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{}, smalltalk.String)})},
  11804. args: [],
  11805. source: "unescaped\x0a\x09<return unescape(self)>",
  11806. messageSends: [],
  11807. referencedClasses: []
  11808. }),
  11809. smalltalk.String);
  11810. smalltalk.addMethod(
  11811. "_withIndexDo_",
  11812. smalltalk.method({
  11813. selector: "withIndexDo:",
  11814. category: 'enumerating',
  11815. fn: function (aBlock){
  11816. var self=this;
  11817. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  11818. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.String)})},
  11819. args: ["aBlock"],
  11820. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  11821. messageSends: [],
  11822. referencedClasses: []
  11823. }),
  11824. smalltalk.String);
  11825. smalltalk.addMethod(
  11826. "_cr",
  11827. smalltalk.method({
  11828. selector: "cr",
  11829. category: 'accessing',
  11830. fn: function (){
  11831. var self=this;
  11832. return smalltalk.withContext(function($ctx1) { return '\r';
  11833. return self}, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.String.klass)})},
  11834. args: [],
  11835. source: "cr\x0a\x09<return '\x5cr'>",
  11836. messageSends: [],
  11837. referencedClasses: []
  11838. }),
  11839. smalltalk.String.klass);
  11840. smalltalk.addMethod(
  11841. "_crlf",
  11842. smalltalk.method({
  11843. selector: "crlf",
  11844. category: 'accessing',
  11845. fn: function (){
  11846. var self=this;
  11847. return smalltalk.withContext(function($ctx1) { return '\r\n';
  11848. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.String.klass)})},
  11849. args: [],
  11850. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  11851. messageSends: [],
  11852. referencedClasses: []
  11853. }),
  11854. smalltalk.String.klass);
  11855. smalltalk.addMethod(
  11856. "_fromCharCode_",
  11857. smalltalk.method({
  11858. selector: "fromCharCode:",
  11859. category: 'instance creation',
  11860. fn: function (anInteger){
  11861. var self=this;
  11862. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(anInteger);
  11863. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger}, smalltalk.String.klass)})},
  11864. args: ["anInteger"],
  11865. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  11866. messageSends: [],
  11867. referencedClasses: []
  11868. }),
  11869. smalltalk.String.klass);
  11870. smalltalk.addMethod(
  11871. "_fromString_",
  11872. smalltalk.method({
  11873. selector: "fromString:",
  11874. category: 'instance creation',
  11875. fn: function (aString){
  11876. var self=this;
  11877. return smalltalk.withContext(function($ctx1) { return new self.fn(aString);
  11878. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.String.klass)})},
  11879. args: ["aString"],
  11880. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  11881. messageSends: [],
  11882. referencedClasses: []
  11883. }),
  11884. smalltalk.String.klass);
  11885. smalltalk.addMethod(
  11886. "_lf",
  11887. smalltalk.method({
  11888. selector: "lf",
  11889. category: 'accessing',
  11890. fn: function (){
  11891. var self=this;
  11892. return smalltalk.withContext(function($ctx1) { return '\n';
  11893. return self}, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.String.klass)})},
  11894. args: [],
  11895. source: "lf\x0a\x09<return '\x5cn'>",
  11896. messageSends: [],
  11897. referencedClasses: []
  11898. }),
  11899. smalltalk.String.klass);
  11900. smalltalk.addMethod(
  11901. "_space",
  11902. smalltalk.method({
  11903. selector: "space",
  11904. category: 'accessing',
  11905. fn: function (){
  11906. var self=this;
  11907. return smalltalk.withContext(function($ctx1) { return ' ';
  11908. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.String.klass)})},
  11909. args: [],
  11910. source: "space\x0a\x09<return ' '>",
  11911. messageSends: [],
  11912. referencedClasses: []
  11913. }),
  11914. smalltalk.String.klass);
  11915. smalltalk.addMethod(
  11916. "_streamClass",
  11917. smalltalk.method({
  11918. selector: "streamClass",
  11919. category: 'accessing',
  11920. fn: function (){
  11921. var self=this;
  11922. return smalltalk.withContext(function($ctx1) { var $1;
  11923. $1=(smalltalk.StringStream || StringStream);
  11924. return $1;
  11925. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.String.klass)})},
  11926. args: [],
  11927. source: "streamClass\x0a\x09 ^StringStream",
  11928. messageSends: [],
  11929. referencedClasses: ["StringStream"]
  11930. }),
  11931. smalltalk.String.klass);
  11932. smalltalk.addMethod(
  11933. "_streamContents_",
  11934. smalltalk.method({
  11935. selector: "streamContents:",
  11936. category: 'instance creation',
  11937. fn: function (blockWithArg){
  11938. var self=this;
  11939. var stream;
  11940. return smalltalk.withContext(function($ctx1) { var $1;
  11941. stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
  11942. _st(blockWithArg)._value_(stream);
  11943. $1=_st(stream)._contents();
  11944. return $1;
  11945. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{blockWithArg:blockWithArg,stream:stream}, smalltalk.String.klass)})},
  11946. args: ["blockWithArg"],
  11947. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  11948. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  11949. referencedClasses: ["String"]
  11950. }),
  11951. smalltalk.String.klass);
  11952. smalltalk.addMethod(
  11953. "_tab",
  11954. smalltalk.method({
  11955. selector: "tab",
  11956. category: 'accessing',
  11957. fn: function (){
  11958. var self=this;
  11959. return smalltalk.withContext(function($ctx1) { return '\t';
  11960. return self}, function($ctx1) {$ctx1.fill(self,"tab",{}, smalltalk.String.klass)})},
  11961. args: [],
  11962. source: "tab\x0a\x09<return '\x5ct'>",
  11963. messageSends: [],
  11964. referencedClasses: []
  11965. }),
  11966. smalltalk.String.klass);
  11967. smalltalk.addMethod(
  11968. "_value_",
  11969. smalltalk.method({
  11970. selector: "value:",
  11971. category: 'instance creation',
  11972. fn: function (aUTFCharCode){
  11973. var self=this;
  11974. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(aUTFCharCode);;
  11975. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode}, smalltalk.String.klass)})},
  11976. args: ["aUTFCharCode"],
  11977. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  11978. messageSends: [],
  11979. referencedClasses: []
  11980. }),
  11981. smalltalk.String.klass);
  11982. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  11983. smalltalk.addMethod(
  11984. "__lt",
  11985. smalltalk.method({
  11986. selector: "<",
  11987. category: 'comparing',
  11988. fn: function (aSymbol){
  11989. var self=this;
  11990. return smalltalk.withContext(function($ctx1) { var $1;
  11991. $1=_st(_st(self)._asString()).__lt(_st(aSymbol)._asString());
  11992. return $1;
  11993. }, function($ctx1) {$ctx1.fill(self,"<",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  11994. args: ["aSymbol"],
  11995. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  11996. messageSends: ["<", "asString"],
  11997. referencedClasses: []
  11998. }),
  11999. smalltalk.Symbol);
  12000. smalltalk.addMethod(
  12001. "__lt_eq",
  12002. smalltalk.method({
  12003. selector: "<=",
  12004. category: 'comparing',
  12005. fn: function (aSymbol){
  12006. var self=this;
  12007. return smalltalk.withContext(function($ctx1) { var $1;
  12008. $1=_st(_st(self)._asString()).__lt_eq(_st(aSymbol)._asString());
  12009. return $1;
  12010. }, function($ctx1) {$ctx1.fill(self,"<=",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  12011. args: ["aSymbol"],
  12012. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  12013. messageSends: ["<=", "asString"],
  12014. referencedClasses: []
  12015. }),
  12016. smalltalk.Symbol);
  12017. smalltalk.addMethod(
  12018. "__eq",
  12019. smalltalk.method({
  12020. selector: "=",
  12021. category: 'comparing',
  12022. fn: function (aSymbol){
  12023. var self=this;
  12024. return smalltalk.withContext(function($ctx1) { var $1,$2;
  12025. $1=_st(_st(aSymbol)._class()).__eq(_st(self)._class());
  12026. if(! smalltalk.assert($1)){
  12027. return false;
  12028. };
  12029. $2=_st(_st(self)._asString()).__eq(_st(aSymbol)._asString());
  12030. return $2;
  12031. }, function($ctx1) {$ctx1.fill(self,"=",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  12032. args: ["aSymbol"],
  12033. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  12034. messageSends: ["ifFalse:", "=", "class", "asString"],
  12035. referencedClasses: []
  12036. }),
  12037. smalltalk.Symbol);
  12038. smalltalk.addMethod(
  12039. "__gt",
  12040. smalltalk.method({
  12041. selector: ">",
  12042. category: 'comparing',
  12043. fn: function (aSymbol){
  12044. var self=this;
  12045. return smalltalk.withContext(function($ctx1) { var $1;
  12046. $1=_st(_st(self)._asString()).__gt(_st(aSymbol)._asString());
  12047. return $1;
  12048. }, function($ctx1) {$ctx1.fill(self,">",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  12049. args: ["aSymbol"],
  12050. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  12051. messageSends: [">", "asString"],
  12052. referencedClasses: []
  12053. }),
  12054. smalltalk.Symbol);
  12055. smalltalk.addMethod(
  12056. "__gt_eq",
  12057. smalltalk.method({
  12058. selector: ">=",
  12059. category: 'comparing',
  12060. fn: function (aSymbol){
  12061. var self=this;
  12062. return smalltalk.withContext(function($ctx1) { var $1;
  12063. $1=_st(_st(self)._asString()).__gt_eq(_st(aSymbol)._asString());
  12064. return $1;
  12065. }, function($ctx1) {$ctx1.fill(self,">=",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  12066. args: ["aSymbol"],
  12067. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  12068. messageSends: [">=", "asString"],
  12069. referencedClasses: []
  12070. }),
  12071. smalltalk.Symbol);
  12072. smalltalk.addMethod(
  12073. "_asJSON",
  12074. smalltalk.method({
  12075. selector: "asJSON",
  12076. category: 'converting',
  12077. fn: function (){
  12078. var self=this;
  12079. return smalltalk.withContext(function($ctx1) { var $1;
  12080. $1=_st(_st(self)._asString())._asJSON();
  12081. return $1;
  12082. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Symbol)})},
  12083. args: [],
  12084. source: "asJSON\x0a\x09^self asString asJSON",
  12085. messageSends: ["asJSON", "asString"],
  12086. referencedClasses: []
  12087. }),
  12088. smalltalk.Symbol);
  12089. smalltalk.addMethod(
  12090. "_asJavascript",
  12091. smalltalk.method({
  12092. selector: "asJavascript",
  12093. category: 'converting',
  12094. fn: function (){
  12095. var self=this;
  12096. return smalltalk.withContext(function($ctx1) { var $1;
  12097. $1=_st(_st("smalltalk.symbolFor(").__comma(_st(_st(self)._asString())._asJavascript())).__comma(")");
  12098. return $1;
  12099. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Symbol)})},
  12100. args: [],
  12101. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(', self asString asJavascript, ')'",
  12102. messageSends: [",", "asJavascript", "asString"],
  12103. referencedClasses: []
  12104. }),
  12105. smalltalk.Symbol);
  12106. smalltalk.addMethod(
  12107. "_asSelector",
  12108. smalltalk.method({
  12109. selector: "asSelector",
  12110. category: 'converting',
  12111. fn: function (){
  12112. var self=this;
  12113. return smalltalk.withContext(function($ctx1) { var $1;
  12114. $1=_st(_st(self)._asString())._asSelector();
  12115. return $1;
  12116. }, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.Symbol)})},
  12117. args: [],
  12118. source: "asSelector\x0a\x09^self asString asSelector",
  12119. messageSends: ["asSelector", "asString"],
  12120. referencedClasses: []
  12121. }),
  12122. smalltalk.Symbol);
  12123. smalltalk.addMethod(
  12124. "_asString",
  12125. smalltalk.method({
  12126. selector: "asString",
  12127. category: 'converting',
  12128. fn: function (){
  12129. var self=this;
  12130. return smalltalk.withContext(function($ctx1) { return self.value;
  12131. return self}, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Symbol)})},
  12132. args: [],
  12133. source: "asString\x0a\x09<return self.value>",
  12134. messageSends: [],
  12135. referencedClasses: []
  12136. }),
  12137. smalltalk.Symbol);
  12138. smalltalk.addMethod(
  12139. "_asSuperSelector",
  12140. smalltalk.method({
  12141. selector: "asSuperSelector",
  12142. category: 'converting',
  12143. fn: function (){
  12144. var self=this;
  12145. return smalltalk.withContext(function($ctx1) { var $1;
  12146. $1=_st(_st(self)._asString())._asSuperSelector();
  12147. return $1;
  12148. }, function($ctx1) {$ctx1.fill(self,"asSuperSelector",{}, smalltalk.Symbol)})},
  12149. args: [],
  12150. source: "asSuperSelector\x0a\x09^self asString asSuperSelector",
  12151. messageSends: ["asSuperSelector", "asString"],
  12152. referencedClasses: []
  12153. }),
  12154. smalltalk.Symbol);
  12155. smalltalk.addMethod(
  12156. "_asSymbol",
  12157. smalltalk.method({
  12158. selector: "asSymbol",
  12159. category: 'converting',
  12160. fn: function (){
  12161. var self=this;
  12162. return smalltalk.withContext(function($ctx1) { var $1;
  12163. $1=self;
  12164. return $1;
  12165. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.Symbol)})},
  12166. args: [],
  12167. source: "asSymbol\x0a\x09^self",
  12168. messageSends: [],
  12169. referencedClasses: []
  12170. }),
  12171. smalltalk.Symbol);
  12172. smalltalk.addMethod(
  12173. "_at_ifAbsent_",
  12174. smalltalk.method({
  12175. selector: "at:ifAbsent:",
  12176. category: 'accessing',
  12177. fn: function (anIndex,aBlock){
  12178. var self=this;
  12179. return smalltalk.withContext(function($ctx1) { var $1;
  12180. $1=_st(_st(self)._asString())._at_ifAbsent_(anIndex,aBlock);
  12181. return $1;
  12182. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Symbol)})},
  12183. args: ["anIndex", "aBlock"],
  12184. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  12185. messageSends: ["at:ifAbsent:", "asString"],
  12186. referencedClasses: []
  12187. }),
  12188. smalltalk.Symbol);
  12189. smalltalk.addMethod(
  12190. "_collect_",
  12191. smalltalk.method({
  12192. selector: "collect:",
  12193. category: 'enumerating',
  12194. fn: function (aBlock){
  12195. var self=this;
  12196. return smalltalk.withContext(function($ctx1) { var $1;
  12197. $1=_st(_st(_st(self)._asString())._collect_(aBlock))._asSymbol();
  12198. return $1;
  12199. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Symbol)})},
  12200. args: ["aBlock"],
  12201. source: "collect: aBlock\x0a\x09^ (self asString collect: aBlock) asSymbol",
  12202. messageSends: ["asSymbol", "collect:", "asString"],
  12203. referencedClasses: []
  12204. }),
  12205. smalltalk.Symbol);
  12206. smalltalk.addMethod(
  12207. "_copyFrom_to_",
  12208. smalltalk.method({
  12209. selector: "copyFrom:to:",
  12210. category: 'copying',
  12211. fn: function (anIndex,anotherIndex){
  12212. var self=this;
  12213. return smalltalk.withContext(function($ctx1) { var $1;
  12214. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._copyFrom_to_(anIndex,anotherIndex));
  12215. return $1;
  12216. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.Symbol)})},
  12217. args: ["anIndex", "anotherIndex"],
  12218. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  12219. messageSends: ["fromString:", "copyFrom:to:", "asString", "class"],
  12220. referencedClasses: []
  12221. }),
  12222. smalltalk.Symbol);
  12223. smalltalk.addMethod(
  12224. "_deepCopy",
  12225. smalltalk.method({
  12226. selector: "deepCopy",
  12227. category: 'copying',
  12228. fn: function (){
  12229. var self=this;
  12230. return smalltalk.withContext(function($ctx1) { var $1;
  12231. $1=self;
  12232. return $1;
  12233. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Symbol)})},
  12234. args: [],
  12235. source: "deepCopy\x0a\x09^self",
  12236. messageSends: [],
  12237. referencedClasses: []
  12238. }),
  12239. smalltalk.Symbol);
  12240. smalltalk.addMethod(
  12241. "_detect_",
  12242. smalltalk.method({
  12243. selector: "detect:",
  12244. category: 'enumerating',
  12245. fn: function (aBlock){
  12246. var self=this;
  12247. return smalltalk.withContext(function($ctx1) { var $1;
  12248. $1=_st(_st(self)._asString())._detect_(aBlock);
  12249. return $1;
  12250. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Symbol)})},
  12251. args: ["aBlock"],
  12252. source: "detect: aBlock\x0a\x09^ self asString detect: aBlock",
  12253. messageSends: ["detect:", "asString"],
  12254. referencedClasses: []
  12255. }),
  12256. smalltalk.Symbol);
  12257. smalltalk.addMethod(
  12258. "_do_",
  12259. smalltalk.method({
  12260. selector: "do:",
  12261. category: 'enumerating',
  12262. fn: function (aBlock){
  12263. var self=this;
  12264. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._do_(aBlock);
  12265. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Symbol)})},
  12266. args: ["aBlock"],
  12267. source: "do: aBlock\x0a\x09self asString do: aBlock",
  12268. messageSends: ["do:", "asString"],
  12269. referencedClasses: []
  12270. }),
  12271. smalltalk.Symbol);
  12272. smalltalk.addMethod(
  12273. "_isSymbol",
  12274. smalltalk.method({
  12275. selector: "isSymbol",
  12276. category: 'printing',
  12277. fn: function (){
  12278. var self=this;
  12279. return smalltalk.withContext(function($ctx1) { return true;
  12280. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{}, smalltalk.Symbol)})},
  12281. args: [],
  12282. source: "isSymbol\x0a\x09^true",
  12283. messageSends: [],
  12284. referencedClasses: []
  12285. }),
  12286. smalltalk.Symbol);
  12287. smalltalk.addMethod(
  12288. "_printString",
  12289. smalltalk.method({
  12290. selector: "printString",
  12291. category: 'printing',
  12292. fn: function (){
  12293. var self=this;
  12294. return smalltalk.withContext(function($ctx1) { var $1;
  12295. $1=_st("#").__comma(_st(self)._asString());
  12296. return $1;
  12297. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Symbol)})},
  12298. args: [],
  12299. source: "printString\x0a\x09^'#', self asString",
  12300. messageSends: [",", "asString"],
  12301. referencedClasses: []
  12302. }),
  12303. smalltalk.Symbol);
  12304. smalltalk.addMethod(
  12305. "_select_",
  12306. smalltalk.method({
  12307. selector: "select:",
  12308. category: 'enumerating',
  12309. fn: function (aBlock){
  12310. var self=this;
  12311. return smalltalk.withContext(function($ctx1) { var $1;
  12312. $1=_st(_st(_st(self)._asString())._select_(aBlock))._asSymbol();
  12313. return $1;
  12314. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock}, smalltalk.Symbol)})},
  12315. args: ["aBlock"],
  12316. source: "select: aBlock\x0a\x09^ (self asString select: aBlock) asSymbol",
  12317. messageSends: ["asSymbol", "select:", "asString"],
  12318. referencedClasses: []
  12319. }),
  12320. smalltalk.Symbol);
  12321. smalltalk.addMethod(
  12322. "_shallowCopy",
  12323. smalltalk.method({
  12324. selector: "shallowCopy",
  12325. category: 'copying',
  12326. fn: function (){
  12327. var self=this;
  12328. return smalltalk.withContext(function($ctx1) { var $1;
  12329. $1=self;
  12330. return $1;
  12331. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.Symbol)})},
  12332. args: [],
  12333. source: "shallowCopy\x0a\x09^self",
  12334. messageSends: [],
  12335. referencedClasses: []
  12336. }),
  12337. smalltalk.Symbol);
  12338. smalltalk.addMethod(
  12339. "_size",
  12340. smalltalk.method({
  12341. selector: "size",
  12342. category: 'accessing',
  12343. fn: function (){
  12344. var self=this;
  12345. return smalltalk.withContext(function($ctx1) { var $1;
  12346. $1=_st(_st(self)._asString())._size();
  12347. return $1;
  12348. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Symbol)})},
  12349. args: [],
  12350. source: "size\x0a\x09^self asString size",
  12351. messageSends: ["size", "asString"],
  12352. referencedClasses: []
  12353. }),
  12354. smalltalk.Symbol);
  12355. smalltalk.addMethod(
  12356. "_value_",
  12357. smalltalk.method({
  12358. selector: "value:",
  12359. category: 'evaluating',
  12360. fn: function (anObject){
  12361. var self=this;
  12362. return smalltalk.withContext(function($ctx1) { var $1;
  12363. $1=_st(anObject)._perform_(self);
  12364. return $1;
  12365. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject}, smalltalk.Symbol)})},
  12366. args: ["anObject"],
  12367. source: "value: anObject \x0a\x09^anObject perform: self",
  12368. messageSends: ["perform:"],
  12369. referencedClasses: []
  12370. }),
  12371. smalltalk.Symbol);
  12372. smalltalk.addMethod(
  12373. "_withIndexDo_",
  12374. smalltalk.method({
  12375. selector: "withIndexDo:",
  12376. category: 'enumerating',
  12377. fn: function (aBlock){
  12378. var self=this;
  12379. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._withIndexDo_(aBlock);
  12380. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.Symbol)})},
  12381. args: ["aBlock"],
  12382. source: "withIndexDo: aBlock\x0a\x09self asString withIndexDo: aBlock",
  12383. messageSends: ["withIndexDo:", "asString"],
  12384. referencedClasses: []
  12385. }),
  12386. smalltalk.Symbol);
  12387. smalltalk.addMethod(
  12388. "_basicNew",
  12389. smalltalk.method({
  12390. selector: "basicNew",
  12391. category: 'instance creation',
  12392. fn: function (){
  12393. var self=this;
  12394. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  12395. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{}, smalltalk.Symbol.klass)})},
  12396. args: [],
  12397. source: "basicNew\x0a\x09self shouldNotImplement",
  12398. messageSends: ["shouldNotImplement"],
  12399. referencedClasses: []
  12400. }),
  12401. smalltalk.Symbol.klass);
  12402. smalltalk.addMethod(
  12403. "_fromString_",
  12404. smalltalk.method({
  12405. selector: "fromString:",
  12406. category: 'instance creation',
  12407. fn: function (aString){
  12408. var self=this;
  12409. return smalltalk.withContext(function($ctx1) { var $1;
  12410. $1=_st(self)._lookup_(aString);
  12411. return $1;
  12412. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.Symbol.klass)})},
  12413. args: ["aString"],
  12414. source: "fromString: aString\x0a\x09^self lookup: aString",
  12415. messageSends: ["lookup:"],
  12416. referencedClasses: []
  12417. }),
  12418. smalltalk.Symbol.klass);
  12419. smalltalk.addMethod(
  12420. "_lookup_",
  12421. smalltalk.method({
  12422. selector: "lookup:",
  12423. category: 'instance creation',
  12424. fn: function (aString){
  12425. var self=this;
  12426. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor(aString);;
  12427. return self}, function($ctx1) {$ctx1.fill(self,"lookup:",{aString:aString}, smalltalk.Symbol.klass)})},
  12428. args: ["aString"],
  12429. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  12430. messageSends: [],
  12431. referencedClasses: []
  12432. }),
  12433. smalltalk.Symbol.klass);
  12434. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  12435. smalltalk.addMethod(
  12436. "__eq",
  12437. smalltalk.method({
  12438. selector: "=",
  12439. category: 'comparing',
  12440. fn: function (aCollection){
  12441. var self=this;
  12442. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  12443. var $early={};
  12444. try {
  12445. $1=_st(_st(self)._class()).__eq(_st(aCollection)._class());
  12446. if(! smalltalk.assert($1)){
  12447. return false;
  12448. };
  12449. $2=_st(_st(self)._size()).__eq(_st(aCollection)._size());
  12450. if(! smalltalk.assert($2)){
  12451. return false;
  12452. };
  12453. _st(self)._do_((function(each){
  12454. return smalltalk.withContext(function($ctx2) { $3=_st(aCollection)._includes_(each);
  12455. if(! smalltalk.assert($3)){
  12456. throw $early=[false];
  12457. };
  12458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  12459. return true;
  12460. }
  12461. catch(e) {if(e===$early)return e[0]; throw e}
  12462. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.Set)})},
  12463. args: ["aCollection"],
  12464. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [:each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  12465. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  12466. referencedClasses: []
  12467. }),
  12468. smalltalk.Set);
  12469. smalltalk.addMethod(
  12470. "_add_",
  12471. smalltalk.method({
  12472. selector: "add:",
  12473. category: 'adding/removing',
  12474. fn: function (anObject){
  12475. var self=this;
  12476. return smalltalk.withContext(function($ctx1) {
  12477. var found;
  12478. for(var i=0; i < self['@elements'].length; i++) {
  12479. if(anObject == self['@elements'][i]) {
  12480. found = true;
  12481. break;
  12482. }
  12483. }
  12484. if(!found) {self['@elements'].push(anObject)}
  12485. ;
  12486. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Set)})},
  12487. args: ["anObject"],
  12488. 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>",
  12489. messageSends: [],
  12490. referencedClasses: []
  12491. }),
  12492. smalltalk.Set);
  12493. smalltalk.addMethod(
  12494. "_asArray",
  12495. smalltalk.method({
  12496. selector: "asArray",
  12497. category: 'converting',
  12498. fn: function (){
  12499. var self=this;
  12500. return smalltalk.withContext(function($ctx1) { var $1;
  12501. $1=_st(self["@elements"])._copy();
  12502. return $1;
  12503. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Set)})},
  12504. args: [],
  12505. source: "asArray\x0a\x09^elements copy",
  12506. messageSends: ["copy"],
  12507. referencedClasses: []
  12508. }),
  12509. smalltalk.Set);
  12510. smalltalk.addMethod(
  12511. "_collect_",
  12512. smalltalk.method({
  12513. selector: "collect:",
  12514. category: 'enumerating',
  12515. fn: function (aBlock){
  12516. var self=this;
  12517. return smalltalk.withContext(function($ctx1) { var $1;
  12518. $1=_st(_st(self)._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
  12519. return $1;
  12520. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Set)})},
  12521. args: ["aBlock"],
  12522. source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
  12523. messageSends: ["withAll:", "collect:", "class"],
  12524. referencedClasses: []
  12525. }),
  12526. smalltalk.Set);
  12527. smalltalk.addMethod(
  12528. "_detect_ifNone_",
  12529. smalltalk.method({
  12530. selector: "detect:ifNone:",
  12531. category: 'enumerating',
  12532. fn: function (aBlock,anotherBlock){
  12533. var self=this;
  12534. return smalltalk.withContext(function($ctx1) { var $1;
  12535. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  12536. return $1;
  12537. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Set)})},
  12538. args: ["aBlock", "anotherBlock"],
  12539. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  12540. messageSends: ["detect:ifNone:"],
  12541. referencedClasses: []
  12542. }),
  12543. smalltalk.Set);
  12544. smalltalk.addMethod(
  12545. "_do_",
  12546. smalltalk.method({
  12547. selector: "do:",
  12548. category: 'enumerating',
  12549. fn: function (aBlock){
  12550. var self=this;
  12551. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._do_(aBlock);
  12552. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Set)})},
  12553. args: ["aBlock"],
  12554. source: "do: aBlock\x0a\x09elements do: aBlock",
  12555. messageSends: ["do:"],
  12556. referencedClasses: []
  12557. }),
  12558. smalltalk.Set);
  12559. smalltalk.addMethod(
  12560. "_includes_",
  12561. smalltalk.method({
  12562. selector: "includes:",
  12563. category: 'testing',
  12564. fn: function (anObject){
  12565. var self=this;
  12566. return smalltalk.withContext(function($ctx1) { var $1;
  12567. $1=_st(self["@elements"])._includes_(anObject);
  12568. return $1;
  12569. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.Set)})},
  12570. args: ["anObject"],
  12571. source: "includes: anObject\x0a\x09^elements includes: anObject",
  12572. messageSends: ["includes:"],
  12573. referencedClasses: []
  12574. }),
  12575. smalltalk.Set);
  12576. smalltalk.addMethod(
  12577. "_initialize",
  12578. smalltalk.method({
  12579. selector: "initialize",
  12580. category: 'initialization',
  12581. fn: function (){
  12582. var self=this;
  12583. return smalltalk.withContext(function($ctx1) { smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  12584. self["@elements"]=[];
  12585. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Set)})},
  12586. args: [],
  12587. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  12588. messageSends: ["initialize"],
  12589. referencedClasses: []
  12590. }),
  12591. smalltalk.Set);
  12592. smalltalk.addMethod(
  12593. "_remove_",
  12594. smalltalk.method({
  12595. selector: "remove:",
  12596. category: 'adding/removing',
  12597. fn: function (anObject){
  12598. var self=this;
  12599. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._remove_(anObject);
  12600. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Set)})},
  12601. args: ["anObject"],
  12602. source: "remove: anObject\x0a\x09elements remove: anObject",
  12603. messageSends: ["remove:"],
  12604. referencedClasses: []
  12605. }),
  12606. smalltalk.Set);
  12607. smalltalk.addMethod(
  12608. "_select_",
  12609. smalltalk.method({
  12610. selector: "select:",
  12611. category: 'enumerating',
  12612. fn: function (aBlock){
  12613. var self=this;
  12614. var collection;
  12615. return smalltalk.withContext(function($ctx1) { var $1,$2;
  12616. collection=_st(_st(self)._class())._new();
  12617. _st(self)._do_((function(each){
  12618. return smalltalk.withContext(function($ctx2) { $1=_st(aBlock)._value_(each);
  12619. if(smalltalk.assert($1)){
  12620. return _st(collection)._add_(each);
  12621. };
  12622. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  12623. $2=collection;
  12624. return $2;
  12625. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection}, smalltalk.Set)})},
  12626. args: ["aBlock"],
  12627. 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",
  12628. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  12629. referencedClasses: []
  12630. }),
  12631. smalltalk.Set);
  12632. smalltalk.addMethod(
  12633. "_size",
  12634. smalltalk.method({
  12635. selector: "size",
  12636. category: 'accessing',
  12637. fn: function (){
  12638. var self=this;
  12639. return smalltalk.withContext(function($ctx1) { var $1;
  12640. $1=_st(self["@elements"])._size();
  12641. return $1;
  12642. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Set)})},
  12643. args: [],
  12644. source: "size\x0a\x09^elements size",
  12645. messageSends: ["size"],
  12646. referencedClasses: []
  12647. }),
  12648. smalltalk.Set);
  12649. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  12650. smalltalk.Queue.comment="A Queue am a one-sided queue.\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 the Queue; write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to."
  12651. smalltalk.addMethod(
  12652. "_back_",
  12653. smalltalk.method({
  12654. selector: "back:",
  12655. category: 'accessing',
  12656. fn: function (anObject){
  12657. var self=this;
  12658. return smalltalk.withContext(function($ctx1) { _st(self["@write"])._add_(anObject);
  12659. return self}, function($ctx1) {$ctx1.fill(self,"back:",{anObject:anObject}, smalltalk.Queue)})},
  12660. args: ["anObject"],
  12661. source: "back: anObject\x0a\x09write add: anObject",
  12662. messageSends: ["add:"],
  12663. referencedClasses: []
  12664. }),
  12665. smalltalk.Queue);
  12666. smalltalk.addMethod(
  12667. "_front",
  12668. smalltalk.method({
  12669. selector: "front",
  12670. category: 'accessing',
  12671. fn: function (){
  12672. var self=this;
  12673. return smalltalk.withContext(function($ctx1) { var $1;
  12674. $1=_st(self)._frontIfAbsent_((function(){
  12675. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Cannot read from empty Queue.");
  12676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12677. return $1;
  12678. }, function($ctx1) {$ctx1.fill(self,"front",{}, smalltalk.Queue)})},
  12679. args: [],
  12680. source: "front\x0a ^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  12681. messageSends: ["frontIfAbsent:", "error:"],
  12682. referencedClasses: []
  12683. }),
  12684. smalltalk.Queue);
  12685. smalltalk.addMethod(
  12686. "_frontIfAbsent_",
  12687. smalltalk.method({
  12688. selector: "frontIfAbsent:",
  12689. category: 'accessing',
  12690. fn: function (aBlock){
  12691. var self=this;
  12692. var result;
  12693. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  12694. var $early={};
  12695. try {
  12696. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  12697. return smalltalk.withContext(function($ctx2) { $1=_st(self["@write"])._isEmpty();
  12698. if(smalltalk.assert($1)){
  12699. $2=_st(self["@readIndex"]).__gt((1));
  12700. if(smalltalk.assert($2)){
  12701. self["@read"]=[];
  12702. self["@read"];
  12703. self["@readIndex"]=(1);
  12704. self["@readIndex"];
  12705. };
  12706. $3=_st(aBlock)._value();
  12707. throw $early=[$3];
  12708. };
  12709. self["@read"]=self["@write"];
  12710. self["@read"];
  12711. self["@readIndex"]=(1);
  12712. self["@readIndex"];
  12713. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  12714. self["@write"];
  12715. return _st(self["@read"])._first();
  12716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12717. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  12718. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  12719. $4=result;
  12720. return $4;
  12721. }
  12722. catch(e) {if(e===$early)return e[0]; throw e}
  12723. }, function($ctx1) {$ctx1.fill(self,"frontIfAbsent:",{aBlock:aBlock,result:result}, smalltalk.Queue)})},
  12724. args: ["aBlock"],
  12725. source: "frontIfAbsent: 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 \x09read := write.\x0a \x09readIndex := 1.\x0a \x09write := OrderedCollection new.\x0a \x09read first ].\x0a read at: readIndex put: nil.\x0a readIndex := readIndex + 1.\x0a ^result",
  12726. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  12727. referencedClasses: ["OrderedCollection"]
  12728. }),
  12729. smalltalk.Queue);
  12730. smalltalk.addMethod(
  12731. "_initialize",
  12732. smalltalk.method({
  12733. selector: "initialize",
  12734. category: 'initialization',
  12735. fn: function (){
  12736. var self=this;
  12737. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  12738. self["@read"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  12739. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  12740. self["@readIndex"]=(1);
  12741. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Queue)})},
  12742. args: [],
  12743. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a write := OrderedCollection new.\x0a readIndex := 1",
  12744. messageSends: ["initialize", "new"],
  12745. referencedClasses: ["OrderedCollection"]
  12746. }),
  12747. smalltalk.Queue);
  12748. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  12749. smalltalk.addMethod(
  12750. "_compile_",
  12751. smalltalk.method({
  12752. selector: "compile:",
  12753. category: 'evaluating',
  12754. fn: function (aString){
  12755. var self=this;
  12756. return smalltalk.withContext(function($ctx1) { return self.compile(aString);
  12757. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.RegularExpression)})},
  12758. args: ["aString"],
  12759. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  12760. messageSends: [],
  12761. referencedClasses: []
  12762. }),
  12763. smalltalk.RegularExpression);
  12764. smalltalk.addMethod(
  12765. "_exec_",
  12766. smalltalk.method({
  12767. selector: "exec:",
  12768. category: 'evaluating',
  12769. fn: function (aString){
  12770. var self=this;
  12771. return smalltalk.withContext(function($ctx1) { return self.exec(aString) || nil;
  12772. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString}, smalltalk.RegularExpression)})},
  12773. args: ["aString"],
  12774. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  12775. messageSends: [],
  12776. referencedClasses: []
  12777. }),
  12778. smalltalk.RegularExpression);
  12779. smalltalk.addMethod(
  12780. "_test_",
  12781. smalltalk.method({
  12782. selector: "test:",
  12783. category: 'evaluating',
  12784. fn: function (aString){
  12785. var self=this;
  12786. return smalltalk.withContext(function($ctx1) { return self.test(aString);
  12787. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString}, smalltalk.RegularExpression)})},
  12788. args: ["aString"],
  12789. source: "test: aString\x0a\x09<return self.test(aString)>",
  12790. messageSends: [],
  12791. referencedClasses: []
  12792. }),
  12793. smalltalk.RegularExpression);
  12794. smalltalk.addMethod(
  12795. "_fromString_",
  12796. smalltalk.method({
  12797. selector: "fromString:",
  12798. category: 'instance creation',
  12799. fn: function (aString){
  12800. var self=this;
  12801. return smalltalk.withContext(function($ctx1) { var $1;
  12802. $1=_st(self)._fromString_flag_(aString,"");
  12803. return $1;
  12804. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.RegularExpression.klass)})},
  12805. args: ["aString"],
  12806. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  12807. messageSends: ["fromString:flag:"],
  12808. referencedClasses: []
  12809. }),
  12810. smalltalk.RegularExpression.klass);
  12811. smalltalk.addMethod(
  12812. "_fromString_flag_",
  12813. smalltalk.method({
  12814. selector: "fromString:flag:",
  12815. category: 'instance creation',
  12816. fn: function (aString,anotherString){
  12817. var self=this;
  12818. return smalltalk.withContext(function($ctx1) { return new RegExp(aString, anotherString);
  12819. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString}, smalltalk.RegularExpression.klass)})},
  12820. args: ["aString", "anotherString"],
  12821. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  12822. messageSends: [],
  12823. referencedClasses: []
  12824. }),
  12825. smalltalk.RegularExpression.klass);
  12826. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  12827. smalltalk.addMethod(
  12828. "_atEnd",
  12829. smalltalk.method({
  12830. selector: "atEnd",
  12831. category: 'testing',
  12832. fn: function (){
  12833. var self=this;
  12834. return smalltalk.withContext(function($ctx1) { var $1;
  12835. $1=_st(_st(self)._position()).__eq(_st(self)._size());
  12836. return $1;
  12837. }, function($ctx1) {$ctx1.fill(self,"atEnd",{}, smalltalk.Stream)})},
  12838. args: [],
  12839. source: "atEnd\x0a\x09^self position = self size",
  12840. messageSends: ["=", "size", "position"],
  12841. referencedClasses: []
  12842. }),
  12843. smalltalk.Stream);
  12844. smalltalk.addMethod(
  12845. "_atStart",
  12846. smalltalk.method({
  12847. selector: "atStart",
  12848. category: 'testing',
  12849. fn: function (){
  12850. var self=this;
  12851. return smalltalk.withContext(function($ctx1) { var $1;
  12852. $1=_st(_st(self)._position()).__eq((0));
  12853. return $1;
  12854. }, function($ctx1) {$ctx1.fill(self,"atStart",{}, smalltalk.Stream)})},
  12855. args: [],
  12856. source: "atStart\x0a\x09^self position = 0",
  12857. messageSends: ["=", "position"],
  12858. referencedClasses: []
  12859. }),
  12860. smalltalk.Stream);
  12861. smalltalk.addMethod(
  12862. "_close",
  12863. smalltalk.method({
  12864. selector: "close",
  12865. category: 'actions',
  12866. fn: function (){
  12867. var self=this;
  12868. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"close",{}, smalltalk.Stream)})},
  12869. args: [],
  12870. source: "close",
  12871. messageSends: [],
  12872. referencedClasses: []
  12873. }),
  12874. smalltalk.Stream);
  12875. smalltalk.addMethod(
  12876. "_collection",
  12877. smalltalk.method({
  12878. selector: "collection",
  12879. category: 'accessing',
  12880. fn: function (){
  12881. var self=this;
  12882. return smalltalk.withContext(function($ctx1) { var $1;
  12883. $1=self["@collection"];
  12884. return $1;
  12885. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.Stream)})},
  12886. args: [],
  12887. source: "collection\x0a\x09^collection",
  12888. messageSends: [],
  12889. referencedClasses: []
  12890. }),
  12891. smalltalk.Stream);
  12892. smalltalk.addMethod(
  12893. "_contents",
  12894. smalltalk.method({
  12895. selector: "contents",
  12896. category: 'accessing',
  12897. fn: function (){
  12898. var self=this;
  12899. return smalltalk.withContext(function($ctx1) { var $1;
  12900. $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
  12901. return $1;
  12902. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.Stream)})},
  12903. args: [],
  12904. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  12905. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  12906. referencedClasses: []
  12907. }),
  12908. smalltalk.Stream);
  12909. smalltalk.addMethod(
  12910. "_do_",
  12911. smalltalk.method({
  12912. selector: "do:",
  12913. category: 'enumerating',
  12914. fn: function (aBlock){
  12915. var self=this;
  12916. return smalltalk.withContext(function($ctx1) { _st((function(){
  12917. return smalltalk.withContext(function($ctx2) { return _st(self)._atEnd();
  12918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  12919. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._next());
  12920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12921. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Stream)})},
  12922. args: ["aBlock"],
  12923. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  12924. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  12925. referencedClasses: []
  12926. }),
  12927. smalltalk.Stream);
  12928. smalltalk.addMethod(
  12929. "_flush",
  12930. smalltalk.method({
  12931. selector: "flush",
  12932. category: 'actions',
  12933. fn: function (){
  12934. var self=this;
  12935. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"flush",{}, smalltalk.Stream)})},
  12936. args: [],
  12937. source: "flush",
  12938. messageSends: [],
  12939. referencedClasses: []
  12940. }),
  12941. smalltalk.Stream);
  12942. smalltalk.addMethod(
  12943. "_isEmpty",
  12944. smalltalk.method({
  12945. selector: "isEmpty",
  12946. category: 'testing',
  12947. fn: function (){
  12948. var self=this;
  12949. return smalltalk.withContext(function($ctx1) { var $1;
  12950. $1=_st(_st(self)._size()).__eq((0));
  12951. return $1;
  12952. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Stream)})},
  12953. args: [],
  12954. source: "isEmpty\x0a\x09^self size = 0",
  12955. messageSends: ["=", "size"],
  12956. referencedClasses: []
  12957. }),
  12958. smalltalk.Stream);
  12959. smalltalk.addMethod(
  12960. "_next",
  12961. smalltalk.method({
  12962. selector: "next",
  12963. category: 'reading',
  12964. fn: function (){
  12965. var self=this;
  12966. return smalltalk.withContext(function($ctx1) { var $2,$1;
  12967. $2=_st(self)._atEnd();
  12968. if(smalltalk.assert($2)){
  12969. $1=nil;
  12970. } else {
  12971. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  12972. $1=_st(self["@collection"])._at_(_st(self)._position());
  12973. };
  12974. return $1;
  12975. }, function($ctx1) {$ctx1.fill(self,"next",{}, smalltalk.Stream)})},
  12976. args: [],
  12977. 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]",
  12978. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  12979. referencedClasses: []
  12980. }),
  12981. smalltalk.Stream);
  12982. smalltalk.addMethod(
  12983. "_next_",
  12984. smalltalk.method({
  12985. selector: "next:",
  12986. category: 'reading',
  12987. fn: function (anInteger){
  12988. var self=this;
  12989. var tempCollection;
  12990. return smalltalk.withContext(function($ctx1) { var $1,$2;
  12991. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  12992. _st(anInteger)._timesRepeat_((function(){
  12993. return smalltalk.withContext(function($ctx2) { $1=_st(self)._atEnd();
  12994. if(! smalltalk.assert($1)){
  12995. return _st(tempCollection)._add_(_st(self)._next());
  12996. };
  12997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12998. $2=tempCollection;
  12999. return $2;
  13000. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.Stream)})},
  13001. args: ["anInteger"],
  13002. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next]].\x0a\x09^tempCollection",
  13003. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  13004. referencedClasses: []
  13005. }),
  13006. smalltalk.Stream);
  13007. smalltalk.addMethod(
  13008. "_nextPut_",
  13009. smalltalk.method({
  13010. selector: "nextPut:",
  13011. category: 'writing',
  13012. fn: function (anObject){
  13013. var self=this;
  13014. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  13015. _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
  13016. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  13017. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject}, smalltalk.Stream)})},
  13018. args: ["anObject"],
  13019. 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)",
  13020. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  13021. referencedClasses: []
  13022. }),
  13023. smalltalk.Stream);
  13024. smalltalk.addMethod(
  13025. "_nextPutAll_",
  13026. smalltalk.method({
  13027. selector: "nextPutAll:",
  13028. category: 'writing',
  13029. fn: function (aCollection){
  13030. var self=this;
  13031. return smalltalk.withContext(function($ctx1) { _st(aCollection)._do_((function(each){
  13032. return smalltalk.withContext(function($ctx2) { return _st(self)._nextPut_(each);
  13033. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  13034. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection}, smalltalk.Stream)})},
  13035. args: ["aCollection"],
  13036. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  13037. messageSends: ["do:", "nextPut:"],
  13038. referencedClasses: []
  13039. }),
  13040. smalltalk.Stream);
  13041. smalltalk.addMethod(
  13042. "_peek",
  13043. smalltalk.method({
  13044. selector: "peek",
  13045. category: 'reading',
  13046. fn: function (){
  13047. var self=this;
  13048. return smalltalk.withContext(function($ctx1) { var $2,$1;
  13049. $2=_st(self)._atEnd();
  13050. if(! smalltalk.assert($2)){
  13051. $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
  13052. };
  13053. return $1;
  13054. }, function($ctx1) {$ctx1.fill(self,"peek",{}, smalltalk.Stream)})},
  13055. args: [],
  13056. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  13057. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  13058. referencedClasses: []
  13059. }),
  13060. smalltalk.Stream);
  13061. smalltalk.addMethod(
  13062. "_position",
  13063. smalltalk.method({
  13064. selector: "position",
  13065. category: 'accessing',
  13066. fn: function (){
  13067. var self=this;
  13068. return smalltalk.withContext(function($ctx1) { var $2,$1;
  13069. $2=self["@position"];
  13070. if(($receiver = $2) == nil || $receiver == undefined){
  13071. self["@position"]=(0);
  13072. $1=self["@position"];
  13073. } else {
  13074. $1=$2;
  13075. };
  13076. return $1;
  13077. }, function($ctx1) {$ctx1.fill(self,"position",{}, smalltalk.Stream)})},
  13078. args: [],
  13079. source: "position\x0a\x09^position ifNil: [position := 0]",
  13080. messageSends: ["ifNil:"],
  13081. referencedClasses: []
  13082. }),
  13083. smalltalk.Stream);
  13084. smalltalk.addMethod(
  13085. "_position_",
  13086. smalltalk.method({
  13087. selector: "position:",
  13088. category: 'accessing',
  13089. fn: function (anInteger){
  13090. var self=this;
  13091. return smalltalk.withContext(function($ctx1) { self["@position"]=anInteger;
  13092. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger}, smalltalk.Stream)})},
  13093. args: ["anInteger"],
  13094. source: "position: anInteger\x0a\x09position := anInteger",
  13095. messageSends: [],
  13096. referencedClasses: []
  13097. }),
  13098. smalltalk.Stream);
  13099. smalltalk.addMethod(
  13100. "_reset",
  13101. smalltalk.method({
  13102. selector: "reset",
  13103. category: 'actions',
  13104. fn: function (){
  13105. var self=this;
  13106. return smalltalk.withContext(function($ctx1) { _st(self)._position_((0));
  13107. return self}, function($ctx1) {$ctx1.fill(self,"reset",{}, smalltalk.Stream)})},
  13108. args: [],
  13109. source: "reset\x0a\x09self position: 0",
  13110. messageSends: ["position:"],
  13111. referencedClasses: []
  13112. }),
  13113. smalltalk.Stream);
  13114. smalltalk.addMethod(
  13115. "_resetContents",
  13116. smalltalk.method({
  13117. selector: "resetContents",
  13118. category: 'actions',
  13119. fn: function (){
  13120. var self=this;
  13121. return smalltalk.withContext(function($ctx1) { _st(self)._reset();
  13122. _st(self)._setStreamSize_((0));
  13123. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{}, smalltalk.Stream)})},
  13124. args: [],
  13125. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13126. messageSends: ["reset", "setStreamSize:"],
  13127. referencedClasses: []
  13128. }),
  13129. smalltalk.Stream);
  13130. smalltalk.addMethod(
  13131. "_setCollection_",
  13132. smalltalk.method({
  13133. selector: "setCollection:",
  13134. category: 'accessing',
  13135. fn: function (aCollection){
  13136. var self=this;
  13137. return smalltalk.withContext(function($ctx1) { self["@collection"]=aCollection;
  13138. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection}, smalltalk.Stream)})},
  13139. args: ["aCollection"],
  13140. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13141. messageSends: [],
  13142. referencedClasses: []
  13143. }),
  13144. smalltalk.Stream);
  13145. smalltalk.addMethod(
  13146. "_setStreamSize_",
  13147. smalltalk.method({
  13148. selector: "setStreamSize:",
  13149. category: 'accessing',
  13150. fn: function (anInteger){
  13151. var self=this;
  13152. return smalltalk.withContext(function($ctx1) { self["@streamSize"]=anInteger;
  13153. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger}, smalltalk.Stream)})},
  13154. args: ["anInteger"],
  13155. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13156. messageSends: [],
  13157. referencedClasses: []
  13158. }),
  13159. smalltalk.Stream);
  13160. smalltalk.addMethod(
  13161. "_setToEnd",
  13162. smalltalk.method({
  13163. selector: "setToEnd",
  13164. category: 'positioning',
  13165. fn: function (){
  13166. var self=this;
  13167. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(self)._size());
  13168. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{}, smalltalk.Stream)})},
  13169. args: [],
  13170. source: "setToEnd\x0a\x09self position: self size",
  13171. messageSends: ["position:", "size"],
  13172. referencedClasses: []
  13173. }),
  13174. smalltalk.Stream);
  13175. smalltalk.addMethod(
  13176. "_size",
  13177. smalltalk.method({
  13178. selector: "size",
  13179. category: 'accessing',
  13180. fn: function (){
  13181. var self=this;
  13182. return smalltalk.withContext(function($ctx1) { var $1;
  13183. $1=_st(self)._streamSize();
  13184. return $1;
  13185. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Stream)})},
  13186. args: [],
  13187. source: "size\x0a\x09^self streamSize",
  13188. messageSends: ["streamSize"],
  13189. referencedClasses: []
  13190. }),
  13191. smalltalk.Stream);
  13192. smalltalk.addMethod(
  13193. "_skip_",
  13194. smalltalk.method({
  13195. selector: "skip:",
  13196. category: 'positioning',
  13197. fn: function (anInteger){
  13198. var self=this;
  13199. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
  13200. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger}, smalltalk.Stream)})},
  13201. args: ["anInteger"],
  13202. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13203. messageSends: ["position:", "min:max:", "size", "+", "position"],
  13204. referencedClasses: []
  13205. }),
  13206. smalltalk.Stream);
  13207. smalltalk.addMethod(
  13208. "_streamSize",
  13209. smalltalk.method({
  13210. selector: "streamSize",
  13211. category: 'accessing',
  13212. fn: function (){
  13213. var self=this;
  13214. return smalltalk.withContext(function($ctx1) { var $1;
  13215. $1=self["@streamSize"];
  13216. return $1;
  13217. }, function($ctx1) {$ctx1.fill(self,"streamSize",{}, smalltalk.Stream)})},
  13218. args: [],
  13219. source: "streamSize\x0a\x09^streamSize",
  13220. messageSends: [],
  13221. referencedClasses: []
  13222. }),
  13223. smalltalk.Stream);
  13224. smalltalk.addMethod(
  13225. "_on_",
  13226. smalltalk.method({
  13227. selector: "on:",
  13228. category: 'instance creation',
  13229. fn: function (aCollection){
  13230. var self=this;
  13231. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  13232. $2=_st(self)._new();
  13233. _st($2)._setCollection_(aCollection);
  13234. _st($2)._setStreamSize_(_st(aCollection)._size());
  13235. $3=_st($2)._yourself();
  13236. $1=$3;
  13237. return $1;
  13238. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection}, smalltalk.Stream.klass)})},
  13239. args: ["aCollection"],
  13240. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13241. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  13242. referencedClasses: []
  13243. }),
  13244. smalltalk.Stream.klass);
  13245. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  13246. smalltalk.addMethod(
  13247. "_cr",
  13248. smalltalk.method({
  13249. selector: "cr",
  13250. category: 'writing',
  13251. fn: function (){
  13252. var self=this;
  13253. return smalltalk.withContext(function($ctx1) { var $1;
  13254. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._cr());
  13255. return $1;
  13256. }, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.StringStream)})},
  13257. args: [],
  13258. source: "cr\x0a\x09^self nextPutAll: String cr",
  13259. messageSends: ["nextPutAll:", "cr"],
  13260. referencedClasses: ["String"]
  13261. }),
  13262. smalltalk.StringStream);
  13263. smalltalk.addMethod(
  13264. "_crlf",
  13265. smalltalk.method({
  13266. selector: "crlf",
  13267. category: 'writing',
  13268. fn: function (){
  13269. var self=this;
  13270. return smalltalk.withContext(function($ctx1) { var $1;
  13271. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._crlf());
  13272. return $1;
  13273. }, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.StringStream)})},
  13274. args: [],
  13275. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  13276. messageSends: ["nextPutAll:", "crlf"],
  13277. referencedClasses: ["String"]
  13278. }),
  13279. smalltalk.StringStream);
  13280. smalltalk.addMethod(
  13281. "_lf",
  13282. smalltalk.method({
  13283. selector: "lf",
  13284. category: 'writing',
  13285. fn: function (){
  13286. var self=this;
  13287. return smalltalk.withContext(function($ctx1) { var $1;
  13288. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._lf());
  13289. return $1;
  13290. }, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.StringStream)})},
  13291. args: [],
  13292. source: "lf\x0a\x09^self nextPutAll: String lf",
  13293. messageSends: ["nextPutAll:", "lf"],
  13294. referencedClasses: ["String"]
  13295. }),
  13296. smalltalk.StringStream);
  13297. smalltalk.addMethod(
  13298. "_next_",
  13299. smalltalk.method({
  13300. selector: "next:",
  13301. category: 'reading',
  13302. fn: function (anInteger){
  13303. var self=this;
  13304. var tempCollection;
  13305. return smalltalk.withContext(function($ctx1) { var $1,$2;
  13306. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  13307. _st(anInteger)._timesRepeat_((function(){
  13308. return smalltalk.withContext(function($ctx2) { $1=_st(self)._atEnd();
  13309. if(! smalltalk.assert($1)){
  13310. tempCollection=_st(tempCollection).__comma(_st(self)._next());
  13311. return tempCollection;
  13312. };
  13313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13314. $2=tempCollection;
  13315. return $2;
  13316. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.StringStream)})},
  13317. args: ["anInteger"],
  13318. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next]].\x0a\x09^tempCollection",
  13319. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  13320. referencedClasses: []
  13321. }),
  13322. smalltalk.StringStream);
  13323. smalltalk.addMethod(
  13324. "_nextPut_",
  13325. smalltalk.method({
  13326. selector: "nextPut:",
  13327. category: 'writing',
  13328. fn: function (aString){
  13329. var self=this;
  13330. return smalltalk.withContext(function($ctx1) { _st(self)._nextPutAll_(aString);
  13331. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString}, smalltalk.StringStream)})},
  13332. args: ["aString"],
  13333. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13334. messageSends: ["nextPutAll:"],
  13335. referencedClasses: []
  13336. }),
  13337. smalltalk.StringStream);
  13338. smalltalk.addMethod(
  13339. "_nextPutAll_",
  13340. smalltalk.method({
  13341. selector: "nextPutAll:",
  13342. category: 'writing',
  13343. fn: function (aString){
  13344. var self=this;
  13345. return smalltalk.withContext(function($ctx1) { _st(self)._setCollection_(_st(_st(_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position())).__comma(aString)).__comma(_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size())));
  13346. _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
  13347. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  13348. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString}, smalltalk.StringStream)})},
  13349. args: ["aString"],
  13350. source: "nextPutAll: aString\x0a\x09self setCollection: \x0a\x09 (self collection copyFrom: 1 to: self position),\x0a\x09 aString,\x0a\x09 (self collection copyFrom: (self position + 1 + aString size) to: self collection size).\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  13351. messageSends: ["setCollection:", ",", "copyFrom:to:", "+", "size", "position", "collection", "position:", "setStreamSize:", "max:", "streamSize"],
  13352. referencedClasses: []
  13353. }),
  13354. smalltalk.StringStream);
  13355. smalltalk.addMethod(
  13356. "_space",
  13357. smalltalk.method({
  13358. selector: "space",
  13359. category: 'writing',
  13360. fn: function (){
  13361. var self=this;
  13362. return smalltalk.withContext(function($ctx1) { _st(self)._nextPut_(" ");
  13363. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.StringStream)})},
  13364. args: [],
  13365. source: "space\x0a\x09self nextPut: ' '",
  13366. messageSends: ["nextPut:"],
  13367. referencedClasses: []
  13368. }),
  13369. smalltalk.StringStream);
  13370. smalltalk.addPackage('Kernel-Exceptions', {});
  13371. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  13372. 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."
  13373. smalltalk.addMethod(
  13374. "_context",
  13375. smalltalk.method({
  13376. selector: "context",
  13377. category: 'accessing',
  13378. fn: function (){
  13379. var self=this;
  13380. return smalltalk.withContext(function($ctx1) { return self.context;
  13381. return self}, function($ctx1) {$ctx1.fill(self,"context",{}, smalltalk.Error)})},
  13382. args: [],
  13383. source: "context\x0a\x09<return self.context>",
  13384. messageSends: [],
  13385. referencedClasses: []
  13386. }),
  13387. smalltalk.Error);
  13388. smalltalk.addMethod(
  13389. "_initialize",
  13390. smalltalk.method({
  13391. selector: "initialize",
  13392. category: 'initialization',
  13393. fn: function (){
  13394. var self=this;
  13395. return smalltalk.withContext(function($ctx1) { _st(self)._messageText_(_st("Errorclass: ").__comma(_st(_st(self)._class())._name()));
  13396. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Error)})},
  13397. args: [],
  13398. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  13399. messageSends: ["messageText:", ",", "name", "class"],
  13400. referencedClasses: []
  13401. }),
  13402. smalltalk.Error);
  13403. smalltalk.addMethod(
  13404. "_isSmalltalkError",
  13405. smalltalk.method({
  13406. selector: "isSmalltalkError",
  13407. category: 'testing',
  13408. fn: function (){
  13409. var self=this;
  13410. return smalltalk.withContext(function($ctx1) { return self.smalltalkError === true;
  13411. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{}, smalltalk.Error)})},
  13412. args: [],
  13413. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  13414. messageSends: [],
  13415. referencedClasses: []
  13416. }),
  13417. smalltalk.Error);
  13418. smalltalk.addMethod(
  13419. "_jsStack",
  13420. smalltalk.method({
  13421. selector: "jsStack",
  13422. category: 'accessing',
  13423. fn: function (){
  13424. var self=this;
  13425. return smalltalk.withContext(function($ctx1) { return self.stack;
  13426. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{}, smalltalk.Error)})},
  13427. args: [],
  13428. source: "jsStack\x0a\x09<return self.stack>",
  13429. messageSends: [],
  13430. referencedClasses: []
  13431. }),
  13432. smalltalk.Error);
  13433. smalltalk.addMethod(
  13434. "_messageText",
  13435. smalltalk.method({
  13436. selector: "messageText",
  13437. category: 'accessing',
  13438. fn: function (){
  13439. var self=this;
  13440. return smalltalk.withContext(function($ctx1) { var $1;
  13441. $1=self["@messageText"];
  13442. return $1;
  13443. }, function($ctx1) {$ctx1.fill(self,"messageText",{}, smalltalk.Error)})},
  13444. args: [],
  13445. source: "messageText\x0a\x09^messageText",
  13446. messageSends: [],
  13447. referencedClasses: []
  13448. }),
  13449. smalltalk.Error);
  13450. smalltalk.addMethod(
  13451. "_messageText_",
  13452. smalltalk.method({
  13453. selector: "messageText:",
  13454. category: 'accessing',
  13455. fn: function (aString){
  13456. var self=this;
  13457. return smalltalk.withContext(function($ctx1) { self["@messageText"]=aString;
  13458. return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString}, smalltalk.Error)})},
  13459. args: ["aString"],
  13460. source: "messageText: aString\x0a\x09messageText := aString",
  13461. messageSends: [],
  13462. referencedClasses: []
  13463. }),
  13464. smalltalk.Error);
  13465. smalltalk.addMethod(
  13466. "_signal",
  13467. smalltalk.method({
  13468. selector: "signal",
  13469. category: 'signaling',
  13470. fn: function (){
  13471. var self=this;
  13472. return smalltalk.withContext(function($ctx1) { self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  13473. return self}, function($ctx1) {$ctx1.fill(self,"signal",{}, smalltalk.Error)})},
  13474. args: [],
  13475. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  13476. messageSends: [],
  13477. referencedClasses: []
  13478. }),
  13479. smalltalk.Error);
  13480. smalltalk.addMethod(
  13481. "_signal_",
  13482. smalltalk.method({
  13483. selector: "signal:",
  13484. category: 'signaling',
  13485. fn: function (aString){
  13486. var self=this;
  13487. return smalltalk.withContext(function($ctx1) { _st(self)._messageText_(aString);
  13488. _st(self)._signal();
  13489. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString}, smalltalk.Error)})},
  13490. args: ["aString"],
  13491. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  13492. messageSends: ["messageText:", "signal"],
  13493. referencedClasses: []
  13494. }),
  13495. smalltalk.Error);
  13496. smalltalk.addMethod(
  13497. "_signal",
  13498. smalltalk.method({
  13499. selector: "signal",
  13500. category: 'instance creation',
  13501. fn: function (){
  13502. var self=this;
  13503. return smalltalk.withContext(function($ctx1) { var $1;
  13504. $1=_st(_st(self)._new())._signal();
  13505. return $1;
  13506. }, function($ctx1) {$ctx1.fill(self,"signal",{}, smalltalk.Error.klass)})},
  13507. args: [],
  13508. source: "signal\x0a\x09^self new signal",
  13509. messageSends: ["signal", "new"],
  13510. referencedClasses: []
  13511. }),
  13512. smalltalk.Error.klass);
  13513. smalltalk.addMethod(
  13514. "_signal_",
  13515. smalltalk.method({
  13516. selector: "signal:",
  13517. category: 'instance creation',
  13518. fn: function (aString){
  13519. var self=this;
  13520. return smalltalk.withContext(function($ctx1) { var $1;
  13521. $1=_st(_st(self)._new())._signal_(aString);
  13522. return $1;
  13523. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString}, smalltalk.Error.klass)})},
  13524. args: ["aString"],
  13525. source: "signal: aString\x0a\x09 ^self new\x0a\x09\x09signal: aString",
  13526. messageSends: ["signal:", "new"],
  13527. referencedClasses: []
  13528. }),
  13529. smalltalk.Error.klass);
  13530. smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions');
  13531. 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:`"
  13532. smalltalk.addMethod(
  13533. "_context_",
  13534. smalltalk.method({
  13535. selector: "context:",
  13536. category: 'accessing',
  13537. fn: function (aMethodContext){
  13538. var self=this;
  13539. return smalltalk.withContext(function($ctx1) { self.context = aMethodContext;
  13540. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext}, smalltalk.JavaScriptException)})},
  13541. args: ["aMethodContext"],
  13542. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a See boot.js `inContext()` exception handling\x22\x0a \x0a <self.context = aMethodContext>",
  13543. messageSends: [],
  13544. referencedClasses: []
  13545. }),
  13546. smalltalk.JavaScriptException);
  13547. smalltalk.addMethod(
  13548. "_exception",
  13549. smalltalk.method({
  13550. selector: "exception",
  13551. category: 'accessing',
  13552. fn: function (){
  13553. var self=this;
  13554. return smalltalk.withContext(function($ctx1) { var $1;
  13555. $1=self["@exception"];
  13556. return $1;
  13557. }, function($ctx1) {$ctx1.fill(self,"exception",{}, smalltalk.JavaScriptException)})},
  13558. args: [],
  13559. source: "exception\x0a\x09^ exception",
  13560. messageSends: [],
  13561. referencedClasses: []
  13562. }),
  13563. smalltalk.JavaScriptException);
  13564. smalltalk.addMethod(
  13565. "_exception_",
  13566. smalltalk.method({
  13567. selector: "exception:",
  13568. category: 'accessing',
  13569. fn: function (anException){
  13570. var self=this;
  13571. return smalltalk.withContext(function($ctx1) { self["@exception"]=anException;
  13572. return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException}, smalltalk.JavaScriptException)})},
  13573. args: ["anException"],
  13574. source: "exception: anException\x0a\x09exception := anException",
  13575. messageSends: [],
  13576. referencedClasses: []
  13577. }),
  13578. smalltalk.JavaScriptException);
  13579. smalltalk.addMethod(
  13580. "_messageText",
  13581. smalltalk.method({
  13582. selector: "messageText",
  13583. category: 'accessing',
  13584. fn: function (){
  13585. var self=this;
  13586. return smalltalk.withContext(function($ctx1) { return 'JavaScript exception: ' + self["@exception"].toString();
  13587. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{}, smalltalk.JavaScriptException)})},
  13588. args: [],
  13589. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  13590. messageSends: [],
  13591. referencedClasses: []
  13592. }),
  13593. smalltalk.JavaScriptException);
  13594. smalltalk.addMethod(
  13595. "_on_",
  13596. smalltalk.method({
  13597. selector: "on:",
  13598. category: 'instance creation',
  13599. fn: function (anException){
  13600. var self=this;
  13601. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  13602. $2=_st(self)._new();
  13603. _st($2)._exception_(anException);
  13604. $3=_st($2)._yourself();
  13605. $1=$3;
  13606. return $1;
  13607. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException}, smalltalk.JavaScriptException.klass)})},
  13608. args: ["anException"],
  13609. source: "on: anException\x0a\x09^ self new\x0a \x09exception: anException;\x0a yourself",
  13610. messageSends: ["exception:", "new", "yourself"],
  13611. referencedClasses: []
  13612. }),
  13613. smalltalk.JavaScriptException.klass);
  13614. smalltalk.addMethod(
  13615. "_on_context_",
  13616. smalltalk.method({
  13617. selector: "on:context:",
  13618. category: 'instance creation',
  13619. fn: function (anException,aMethodContext){
  13620. var self=this;
  13621. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  13622. $2=_st(self)._new();
  13623. _st($2)._exception_(anException);
  13624. _st($2)._context_(aMethodContext);
  13625. $3=_st($2)._yourself();
  13626. $1=$3;
  13627. return $1;
  13628. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext}, smalltalk.JavaScriptException.klass)})},
  13629. args: ["anException", "aMethodContext"],
  13630. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a \x09exception: anException;\x0a context: aMethodContext;\x0a yourself",
  13631. messageSends: ["exception:", "new", "context:", "yourself"],
  13632. referencedClasses: []
  13633. }),
  13634. smalltalk.JavaScriptException.klass);
  13635. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  13636. smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`."
  13637. smalltalk.addMethod(
  13638. "_message",
  13639. smalltalk.method({
  13640. selector: "message",
  13641. category: 'accessing',
  13642. fn: function (){
  13643. var self=this;
  13644. return smalltalk.withContext(function($ctx1) { var $1;
  13645. $1=self["@message"];
  13646. return $1;
  13647. }, function($ctx1) {$ctx1.fill(self,"message",{}, smalltalk.MessageNotUnderstood)})},
  13648. args: [],
  13649. source: "message\x0a\x09^message",
  13650. messageSends: [],
  13651. referencedClasses: []
  13652. }),
  13653. smalltalk.MessageNotUnderstood);
  13654. smalltalk.addMethod(
  13655. "_message_",
  13656. smalltalk.method({
  13657. selector: "message:",
  13658. category: 'accessing',
  13659. fn: function (aMessage){
  13660. var self=this;
  13661. return smalltalk.withContext(function($ctx1) { self["@message"]=aMessage;
  13662. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage}, smalltalk.MessageNotUnderstood)})},
  13663. args: ["aMessage"],
  13664. source: "message: aMessage\x0a\x09message := aMessage",
  13665. messageSends: [],
  13666. referencedClasses: []
  13667. }),
  13668. smalltalk.MessageNotUnderstood);
  13669. smalltalk.addMethod(
  13670. "_messageText",
  13671. smalltalk.method({
  13672. selector: "messageText",
  13673. category: 'accessing',
  13674. fn: function (){
  13675. var self=this;
  13676. return smalltalk.withContext(function($ctx1) { var $1;
  13677. $1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
  13678. return $1;
  13679. }, function($ctx1) {$ctx1.fill(self,"messageText",{}, smalltalk.MessageNotUnderstood)})},
  13680. args: [],
  13681. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  13682. messageSends: [",", "selector", "message", "asString", "receiver"],
  13683. referencedClasses: []
  13684. }),
  13685. smalltalk.MessageNotUnderstood);
  13686. smalltalk.addMethod(
  13687. "_receiver",
  13688. smalltalk.method({
  13689. selector: "receiver",
  13690. category: 'accessing',
  13691. fn: function (){
  13692. var self=this;
  13693. return smalltalk.withContext(function($ctx1) { var $1;
  13694. $1=self["@receiver"];
  13695. return $1;
  13696. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.MessageNotUnderstood)})},
  13697. args: [],
  13698. source: "receiver\x0a\x09^receiver",
  13699. messageSends: [],
  13700. referencedClasses: []
  13701. }),
  13702. smalltalk.MessageNotUnderstood);
  13703. smalltalk.addMethod(
  13704. "_receiver_",
  13705. smalltalk.method({
  13706. selector: "receiver:",
  13707. category: 'accessing',
  13708. fn: function (anObject){
  13709. var self=this;
  13710. return smalltalk.withContext(function($ctx1) { self["@receiver"]=anObject;
  13711. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.MessageNotUnderstood)})},
  13712. args: ["anObject"],
  13713. source: "receiver: anObject\x0a\x09receiver := anObject",
  13714. messageSends: [],
  13715. referencedClasses: []
  13716. }),
  13717. smalltalk.MessageNotUnderstood);
  13718. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  13719. smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver."
  13720. smalltalk.addMethod(
  13721. "_object",
  13722. smalltalk.method({
  13723. selector: "object",
  13724. category: 'accessing',
  13725. fn: function (){
  13726. var self=this;
  13727. return smalltalk.withContext(function($ctx1) { var $1;
  13728. $1=self["@object"];
  13729. return $1;
  13730. }, function($ctx1) {$ctx1.fill(self,"object",{}, smalltalk.NonBooleanReceiver)})},
  13731. args: [],
  13732. source: "object\x0a\x09^ object",
  13733. messageSends: [],
  13734. referencedClasses: []
  13735. }),
  13736. smalltalk.NonBooleanReceiver);
  13737. smalltalk.addMethod(
  13738. "_object_",
  13739. smalltalk.method({
  13740. selector: "object:",
  13741. category: 'accessing',
  13742. fn: function (anObject){
  13743. var self=this;
  13744. return smalltalk.withContext(function($ctx1) { self["@object"]=anObject;
  13745. return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject}, smalltalk.NonBooleanReceiver)})},
  13746. args: ["anObject"],
  13747. source: "object: anObject\x0a\x09object := anObject",
  13748. messageSends: [],
  13749. referencedClasses: []
  13750. }),
  13751. smalltalk.NonBooleanReceiver);
  13752. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  13753. 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."
  13754. smalltalk.addMethod(
  13755. "_handleError_",
  13756. smalltalk.method({
  13757. selector: "handleError:",
  13758. category: 'error handling',
  13759. fn: function (anError){
  13760. var self=this;
  13761. return smalltalk.withContext(function($ctx1) { var $1;
  13762. $1=_st(anError)._context();
  13763. if(($receiver = $1) == nil || $receiver == undefined){
  13764. $1;
  13765. } else {
  13766. _st(self)._logErrorContext_(_st(anError)._context());
  13767. };
  13768. _st(self)._logError_(anError);
  13769. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError}, smalltalk.ErrorHandler)})},
  13770. args: ["anError"],
  13771. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  13772. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  13773. referencedClasses: []
  13774. }),
  13775. smalltalk.ErrorHandler);
  13776. smalltalk.addMethod(
  13777. "_log_",
  13778. smalltalk.method({
  13779. selector: "log:",
  13780. category: 'private',
  13781. fn: function (aString){
  13782. var self=this;
  13783. return smalltalk.withContext(function($ctx1) { _st(console)._log_(aString);
  13784. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString}, smalltalk.ErrorHandler)})},
  13785. args: ["aString"],
  13786. source: "log: aString\x0a\x09console log: aString",
  13787. messageSends: ["log:"],
  13788. referencedClasses: []
  13789. }),
  13790. smalltalk.ErrorHandler);
  13791. smalltalk.addMethod(
  13792. "_logContext_",
  13793. smalltalk.method({
  13794. selector: "logContext:",
  13795. category: 'private',
  13796. fn: function (aContext){
  13797. var self=this;
  13798. return smalltalk.withContext(function($ctx1) { var $1;
  13799. $1=_st(aContext)._home();
  13800. if(($receiver = $1) == nil || $receiver == undefined){
  13801. $1;
  13802. } else {
  13803. _st(self)._logContext_(_st(aContext)._home());
  13804. };
  13805. _st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(_st(aContext)._selector())._asString()));
  13806. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext}, smalltalk.ErrorHandler)})},
  13807. args: ["aContext"],
  13808. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector asString",
  13809. messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "asString", "selector", "receiver"],
  13810. referencedClasses: []
  13811. }),
  13812. smalltalk.ErrorHandler);
  13813. smalltalk.addMethod(
  13814. "_logError_",
  13815. smalltalk.method({
  13816. selector: "logError:",
  13817. category: 'private',
  13818. fn: function (anError){
  13819. var self=this;
  13820. return smalltalk.withContext(function($ctx1) { _st(self)._log_(_st(anError)._messageText());
  13821. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError}, smalltalk.ErrorHandler)})},
  13822. args: ["anError"],
  13823. source: "logError: anError\x0a\x09self log: anError messageText",
  13824. messageSends: ["log:", "messageText"],
  13825. referencedClasses: []
  13826. }),
  13827. smalltalk.ErrorHandler);
  13828. smalltalk.addMethod(
  13829. "_logErrorContext_",
  13830. smalltalk.method({
  13831. selector: "logErrorContext:",
  13832. category: 'private',
  13833. fn: function (aContext){
  13834. var self=this;
  13835. return smalltalk.withContext(function($ctx1) { var $1,$2;
  13836. $1=aContext;
  13837. if(($receiver = $1) == nil || $receiver == undefined){
  13838. $1;
  13839. } else {
  13840. $2=_st(aContext)._home();
  13841. if(($receiver = $2) == nil || $receiver == undefined){
  13842. $2;
  13843. } else {
  13844. _st(self)._logContext_(_st(aContext)._home());
  13845. };
  13846. };
  13847. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext}, smalltalk.ErrorHandler)})},
  13848. args: ["aContext"],
  13849. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  13850. messageSends: ["ifNotNil:", "logContext:", "home"],
  13851. referencedClasses: []
  13852. }),
  13853. smalltalk.ErrorHandler);
  13854. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  13855. smalltalk.addMethod(
  13856. "_current",
  13857. smalltalk.method({
  13858. selector: "current",
  13859. category: 'accessing',
  13860. fn: function (){
  13861. var self=this;
  13862. return smalltalk.withContext(function($ctx1) { var $2,$1;
  13863. $2=self["@current"];
  13864. if(($receiver = $2) == nil || $receiver == undefined){
  13865. self["@current"]=_st(self)._new();
  13866. $1=self["@current"];
  13867. } else {
  13868. $1=$2;
  13869. };
  13870. return $1;
  13871. }, function($ctx1) {$ctx1.fill(self,"current",{}, smalltalk.ErrorHandler.klass)})},
  13872. args: [],
  13873. source: "current\x0a\x09^current ifNil: [current := self new]",
  13874. messageSends: ["ifNil:", "new"],
  13875. referencedClasses: []
  13876. }),
  13877. smalltalk.ErrorHandler.klass);
  13878. smalltalk.addMethod(
  13879. "_initialize",
  13880. smalltalk.method({
  13881. selector: "initialize",
  13882. category: 'initialization',
  13883. fn: function (){
  13884. var self=this;
  13885. return smalltalk.withContext(function($ctx1) { _st(self)._register();
  13886. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ErrorHandler.klass)})},
  13887. args: [],
  13888. source: "initialize\x0a\x09self register",
  13889. messageSends: ["register"],
  13890. referencedClasses: []
  13891. }),
  13892. smalltalk.ErrorHandler.klass);
  13893. smalltalk.addMethod(
  13894. "_register",
  13895. smalltalk.method({
  13896. selector: "register",
  13897. category: 'initialization',
  13898. fn: function (){
  13899. var self=this;
  13900. return smalltalk.withContext(function($ctx1) { _st((smalltalk.ErrorHandler || ErrorHandler))._setCurrent_(_st(self)._new());
  13901. return self}, function($ctx1) {$ctx1.fill(self,"register",{}, smalltalk.ErrorHandler.klass)})},
  13902. args: [],
  13903. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  13904. messageSends: ["setCurrent:", "new"],
  13905. referencedClasses: ["ErrorHandler"]
  13906. }),
  13907. smalltalk.ErrorHandler.klass);
  13908. smalltalk.addMethod(
  13909. "_setCurrent_",
  13910. smalltalk.method({
  13911. selector: "setCurrent:",
  13912. category: 'accessing',
  13913. fn: function (anHandler){
  13914. var self=this;
  13915. return smalltalk.withContext(function($ctx1) { self["@current"]=anHandler;
  13916. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler}, smalltalk.ErrorHandler.klass)})},
  13917. args: ["anHandler"],
  13918. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  13919. messageSends: [],
  13920. referencedClasses: []
  13921. }),
  13922. smalltalk.ErrorHandler.klass);
  13923. smalltalk.addPackage('Kernel-Transcript', {});
  13924. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  13925. smalltalk.addMethod(
  13926. "_clear",
  13927. smalltalk.method({
  13928. selector: "clear",
  13929. category: 'printing',
  13930. fn: function (){
  13931. var self=this;
  13932. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.ConsoleTranscript)})},
  13933. args: [],
  13934. source: "clear\x0a\x09\x22no op\x22",
  13935. messageSends: [],
  13936. referencedClasses: []
  13937. }),
  13938. smalltalk.ConsoleTranscript);
  13939. smalltalk.addMethod(
  13940. "_cr",
  13941. smalltalk.method({
  13942. selector: "cr",
  13943. category: 'printing',
  13944. fn: function (){
  13945. var self=this;
  13946. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.ConsoleTranscript)})},
  13947. args: [],
  13948. source: "cr\x0a\x09\x22no op\x22",
  13949. messageSends: [],
  13950. referencedClasses: []
  13951. }),
  13952. smalltalk.ConsoleTranscript);
  13953. smalltalk.addMethod(
  13954. "_open",
  13955. smalltalk.method({
  13956. selector: "open",
  13957. category: 'actions',
  13958. fn: function (){
  13959. var self=this;
  13960. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"open",{}, smalltalk.ConsoleTranscript)})},
  13961. args: [],
  13962. source: "open",
  13963. messageSends: [],
  13964. referencedClasses: []
  13965. }),
  13966. smalltalk.ConsoleTranscript);
  13967. smalltalk.addMethod(
  13968. "_show_",
  13969. smalltalk.method({
  13970. selector: "show:",
  13971. category: 'printing',
  13972. fn: function (anObject){
  13973. var self=this;
  13974. return smalltalk.withContext(function($ctx1) { console.log(String(string._asString()));
  13975. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject}, smalltalk.ConsoleTranscript)})},
  13976. args: ["anObject"],
  13977. source: "show: anObject\x0a\x09<console.log(String(string._asString()))>",
  13978. messageSends: [],
  13979. referencedClasses: []
  13980. }),
  13981. smalltalk.ConsoleTranscript);
  13982. smalltalk.addMethod(
  13983. "_initialize",
  13984. smalltalk.method({
  13985. selector: "initialize",
  13986. category: 'initialization',
  13987. fn: function (){
  13988. var self=this;
  13989. return smalltalk.withContext(function($ctx1) { _st((smalltalk.Transcript || Transcript))._register_(_st(self)._new());
  13990. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ConsoleTranscript.klass)})},
  13991. args: [],
  13992. source: "initialize\x0a\x09Transcript register: self new",
  13993. messageSends: ["register:", "new"],
  13994. referencedClasses: ["Transcript"]
  13995. }),
  13996. smalltalk.ConsoleTranscript.klass);
  13997. smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  13998. smalltalk.Transcript.klass.iVarNames = ['current'];
  13999. smalltalk.addMethod(
  14000. "_clear",
  14001. smalltalk.method({
  14002. selector: "clear",
  14003. category: 'printing',
  14004. fn: function (){
  14005. var self=this;
  14006. return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._clear();
  14007. return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.Transcript.klass)})},
  14008. args: [],
  14009. source: "clear\x0a self current clear",
  14010. messageSends: ["clear", "current"],
  14011. referencedClasses: []
  14012. }),
  14013. smalltalk.Transcript.klass);
  14014. smalltalk.addMethod(
  14015. "_cr",
  14016. smalltalk.method({
  14017. selector: "cr",
  14018. category: 'printing',
  14019. fn: function (){
  14020. var self=this;
  14021. return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._show_(_st((smalltalk.String || String))._cr());
  14022. return self}, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.Transcript.klass)})},
  14023. args: [],
  14024. source: "cr\x0a self current show: String cr",
  14025. messageSends: ["show:", "cr", "current"],
  14026. referencedClasses: ["String"]
  14027. }),
  14028. smalltalk.Transcript.klass);
  14029. smalltalk.addMethod(
  14030. "_current",
  14031. smalltalk.method({
  14032. selector: "current",
  14033. category: 'instance creation',
  14034. fn: function (){
  14035. var self=this;
  14036. return smalltalk.withContext(function($ctx1) { var $1;
  14037. $1=self["@current"];
  14038. return $1;
  14039. }, function($ctx1) {$ctx1.fill(self,"current",{}, smalltalk.Transcript.klass)})},
  14040. args: [],
  14041. source: "current\x0a ^current",
  14042. messageSends: [],
  14043. referencedClasses: []
  14044. }),
  14045. smalltalk.Transcript.klass);
  14046. smalltalk.addMethod(
  14047. "_new",
  14048. smalltalk.method({
  14049. selector: "new",
  14050. category: 'instance creation',
  14051. fn: function (){
  14052. var self=this;
  14053. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  14054. return self}, function($ctx1) {$ctx1.fill(self,"new",{}, smalltalk.Transcript.klass)})},
  14055. args: [],
  14056. source: "new\x0a self shouldNotImplement",
  14057. messageSends: ["shouldNotImplement"],
  14058. referencedClasses: []
  14059. }),
  14060. smalltalk.Transcript.klass);
  14061. smalltalk.addMethod(
  14062. "_open",
  14063. smalltalk.method({
  14064. selector: "open",
  14065. category: 'instance creation',
  14066. fn: function (){
  14067. var self=this;
  14068. return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._open();
  14069. return self}, function($ctx1) {$ctx1.fill(self,"open",{}, smalltalk.Transcript.klass)})},
  14070. args: [],
  14071. source: "open\x0a self current open",
  14072. messageSends: ["open", "current"],
  14073. referencedClasses: []
  14074. }),
  14075. smalltalk.Transcript.klass);
  14076. smalltalk.addMethod(
  14077. "_register_",
  14078. smalltalk.method({
  14079. selector: "register:",
  14080. category: 'instance creation',
  14081. fn: function (aTranscript){
  14082. var self=this;
  14083. return smalltalk.withContext(function($ctx1) { self["@current"]=aTranscript;
  14084. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript}, smalltalk.Transcript.klass)})},
  14085. args: ["aTranscript"],
  14086. source: "register: aTranscript\x0a\x09current := aTranscript",
  14087. messageSends: [],
  14088. referencedClasses: []
  14089. }),
  14090. smalltalk.Transcript.klass);
  14091. smalltalk.addMethod(
  14092. "_show_",
  14093. smalltalk.method({
  14094. selector: "show:",
  14095. category: 'printing',
  14096. fn: function (anObject){
  14097. var self=this;
  14098. return smalltalk.withContext(function($ctx1) { _st(_st(self)._current())._show_(anObject);
  14099. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject}, smalltalk.Transcript.klass)})},
  14100. args: ["anObject"],
  14101. source: "show: anObject\x0a self current show: anObject",
  14102. messageSends: ["show:", "current"],
  14103. referencedClasses: []
  14104. }),
  14105. smalltalk.Transcript.klass);
  14106. smalltalk.addPackage('Kernel-Announcements', {});
  14107. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
  14108. smalltalk.AnnouncementSubscription.comment="The subscription is a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible."
  14109. smalltalk.addMethod(
  14110. "_announcementClass",
  14111. smalltalk.method({
  14112. selector: "announcementClass",
  14113. category: 'accessing',
  14114. fn: function (){
  14115. var self=this;
  14116. return smalltalk.withContext(function($ctx1) { var $1;
  14117. $1=self["@announcementClass"];
  14118. return $1;
  14119. }, function($ctx1) {$ctx1.fill(self,"announcementClass",{}, smalltalk.AnnouncementSubscription)})},
  14120. args: [],
  14121. source: "announcementClass\x0a\x09^announcementClass",
  14122. messageSends: [],
  14123. referencedClasses: []
  14124. }),
  14125. smalltalk.AnnouncementSubscription);
  14126. smalltalk.addMethod(
  14127. "_announcementClass_",
  14128. smalltalk.method({
  14129. selector: "announcementClass:",
  14130. category: 'accessing',
  14131. fn: function (aClass){
  14132. var self=this;
  14133. return smalltalk.withContext(function($ctx1) { self["@announcementClass"]=aClass;
  14134. return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass}, smalltalk.AnnouncementSubscription)})},
  14135. args: ["aClass"],
  14136. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  14137. messageSends: [],
  14138. referencedClasses: []
  14139. }),
  14140. smalltalk.AnnouncementSubscription);
  14141. smalltalk.addMethod(
  14142. "_block",
  14143. smalltalk.method({
  14144. selector: "block",
  14145. category: 'accessing',
  14146. fn: function (){
  14147. var self=this;
  14148. return smalltalk.withContext(function($ctx1) { var $1;
  14149. $1=self["@block"];
  14150. return $1;
  14151. }, function($ctx1) {$ctx1.fill(self,"block",{}, smalltalk.AnnouncementSubscription)})},
  14152. args: [],
  14153. source: "block\x0a\x09^block",
  14154. messageSends: [],
  14155. referencedClasses: []
  14156. }),
  14157. smalltalk.AnnouncementSubscription);
  14158. smalltalk.addMethod(
  14159. "_block_",
  14160. smalltalk.method({
  14161. selector: "block:",
  14162. category: 'accessing',
  14163. fn: function (aBlock){
  14164. var self=this;
  14165. return smalltalk.withContext(function($ctx1) { self["@block"]=aBlock;
  14166. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aBlock:aBlock}, smalltalk.AnnouncementSubscription)})},
  14167. args: ["aBlock"],
  14168. source: "block: aBlock\x0a\x09block := aBlock",
  14169. messageSends: [],
  14170. referencedClasses: []
  14171. }),
  14172. smalltalk.AnnouncementSubscription);
  14173. smalltalk.addMethod(
  14174. "_deliver_",
  14175. smalltalk.method({
  14176. selector: "deliver:",
  14177. category: 'announcing',
  14178. fn: function (anAnnouncement){
  14179. var self=this;
  14180. return smalltalk.withContext(function($ctx1) { var $1;
  14181. $1=_st(self)._handlesAnnouncement_(anAnnouncement);
  14182. if(smalltalk.assert($1)){
  14183. _st(_st(self)._block())._value_(anAnnouncement);
  14184. };
  14185. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement}, smalltalk.AnnouncementSubscription)})},
  14186. args: ["anAnnouncement"],
  14187. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
  14188. messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
  14189. referencedClasses: []
  14190. }),
  14191. smalltalk.AnnouncementSubscription);
  14192. smalltalk.addMethod(
  14193. "_handlesAnnouncement_",
  14194. smalltalk.method({
  14195. selector: "handlesAnnouncement:",
  14196. category: 'announcing',
  14197. fn: function (anAnnouncement){
  14198. var self=this;
  14199. return smalltalk.withContext(function($ctx1) { var $1;
  14200. $1=_st(anAnnouncement)._isKindOf_(_st(self)._announcementClass());
  14201. return $1;
  14202. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement}, smalltalk.AnnouncementSubscription)})},
  14203. args: ["anAnnouncement"],
  14204. source: "handlesAnnouncement: anAnnouncement\x0a\x09^anAnnouncement isKindOf: self announcementClass",
  14205. messageSends: ["isKindOf:", "announcementClass"],
  14206. referencedClasses: []
  14207. }),
  14208. smalltalk.AnnouncementSubscription);
  14209. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  14210. smalltalk.Announcer.comment="The code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0aThe Announcer holds annoncement subscriptions (`AnnouncementSubscription`) in a private registry.\x0a\x0aUse `#on:do:` to register subscriptions."
  14211. smalltalk.addMethod(
  14212. "_announce_",
  14213. smalltalk.method({
  14214. selector: "announce:",
  14215. category: 'announcing',
  14216. fn: function (anAnnouncement){
  14217. var self=this;
  14218. return smalltalk.withContext(function($ctx1) { _st(self["@subscriptions"])._do_((function(each){
  14219. return smalltalk.withContext(function($ctx2) { return _st(each)._deliver_(anAnnouncement);
  14220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  14221. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement}, smalltalk.Announcer)})},
  14222. args: ["anAnnouncement"],
  14223. source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
  14224. messageSends: ["do:", "deliver:"],
  14225. referencedClasses: []
  14226. }),
  14227. smalltalk.Announcer);
  14228. smalltalk.addMethod(
  14229. "_initialize",
  14230. smalltalk.method({
  14231. selector: "initialize",
  14232. category: 'initialization',
  14233. fn: function (){
  14234. var self=this;
  14235. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  14236. self["@subscriptions"]=_st((smalltalk.Array || Array))._new();
  14237. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Announcer)})},
  14238. args: [],
  14239. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
  14240. messageSends: ["initialize", "new"],
  14241. referencedClasses: ["Array"]
  14242. }),
  14243. smalltalk.Announcer);
  14244. smalltalk.addMethod(
  14245. "_on_do_",
  14246. smalltalk.method({
  14247. selector: "on:do:",
  14248. category: 'subscribing',
  14249. fn: function (aClass,aBlock){
  14250. var self=this;
  14251. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14252. $1=_st((smalltalk.AnnouncementSubscription || AnnouncementSubscription))._new();
  14253. _st($1)._block_(aBlock);
  14254. _st($1)._announcementClass_(aClass);
  14255. $2=_st($1)._yourself();
  14256. _st(self["@subscriptions"])._add_($2);
  14257. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock}, smalltalk.Announcer)})},
  14258. args: ["aClass", "aBlock"],
  14259. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  14260. messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
  14261. referencedClasses: ["AnnouncementSubscription"]
  14262. }),
  14263. smalltalk.Announcer);
  14264. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  14265. smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces"
  14266. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  14267. smalltalk.addMethod(
  14268. "_current",
  14269. smalltalk.method({
  14270. selector: "current",
  14271. category: 'accessing',
  14272. fn: function (){
  14273. var self=this;
  14274. return smalltalk.withContext(function($ctx1) { var $2,$1;
  14275. $2=self["@current"];
  14276. if(($receiver = $2) == nil || $receiver == undefined){
  14277. self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
  14278. $1=self["@current"];
  14279. } else {
  14280. $1=$2;
  14281. };
  14282. return $1;
  14283. }, function($ctx1) {$ctx1.fill(self,"current",{}, smalltalk.SystemAnnouncer.klass)})},
  14284. args: [],
  14285. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  14286. messageSends: ["ifNil:", "new"],
  14287. referencedClasses: []
  14288. }),
  14289. smalltalk.SystemAnnouncer.klass);
  14290. smalltalk.addMethod(
  14291. "_new",
  14292. smalltalk.method({
  14293. selector: "new",
  14294. category: 'instance creation',
  14295. fn: function (){
  14296. var self=this;
  14297. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  14298. return self}, function($ctx1) {$ctx1.fill(self,"new",{}, smalltalk.SystemAnnouncer.klass)})},
  14299. args: [],
  14300. source: "new\x0a\x09self shouldNotImplement",
  14301. messageSends: ["shouldNotImplement"],
  14302. referencedClasses: []
  14303. }),
  14304. smalltalk.SystemAnnouncer.klass);
  14305. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  14306. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements"
  14307. smalltalk.addMethod(
  14308. "_theClass",
  14309. smalltalk.method({
  14310. selector: "theClass",
  14311. category: 'accessing',
  14312. fn: function (){
  14313. var self=this;
  14314. return smalltalk.withContext(function($ctx1) { var $1;
  14315. $1=self["@theClass"];
  14316. return $1;
  14317. }, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.SystemAnnouncement)})},
  14318. args: [],
  14319. source: "theClass\x0a\x09^ theClass",
  14320. messageSends: [],
  14321. referencedClasses: []
  14322. }),
  14323. smalltalk.SystemAnnouncement);
  14324. smalltalk.addMethod(
  14325. "_theClass_",
  14326. smalltalk.method({
  14327. selector: "theClass:",
  14328. category: 'accessing',
  14329. fn: function (aClass){
  14330. var self=this;
  14331. return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass;
  14332. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass}, smalltalk.SystemAnnouncement)})},
  14333. args: ["aClass"],
  14334. source: "theClass: aClass\x0a\x09theClass := aClass",
  14335. messageSends: [],
  14336. referencedClasses: []
  14337. }),
  14338. smalltalk.SystemAnnouncement);
  14339. smalltalk.addClass('ClassAdded', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  14340. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"
  14341. smalltalk.addClass('ClassCommentChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  14342. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"
  14343. smalltalk.addClass('ClassDefinitionChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  14344. smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
  14345. smalltalk.addClass('ClassRemoved', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  14346. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"
  14347. smalltalk.addClass('ClassRenamed', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  14348. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"
  14349. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  14350. smalltalk.addMethod(
  14351. "_method",
  14352. smalltalk.method({
  14353. selector: "method",
  14354. category: 'accessing',
  14355. fn: function (){
  14356. var self=this;
  14357. return smalltalk.withContext(function($ctx1) { var $1;
  14358. $1=self["@method"];
  14359. return $1;
  14360. }, function($ctx1) {$ctx1.fill(self,"method",{}, smalltalk.MethodAnnouncement)})},
  14361. args: [],
  14362. source: "method\x0a\x09^ method",
  14363. messageSends: [],
  14364. referencedClasses: []
  14365. }),
  14366. smalltalk.MethodAnnouncement);
  14367. smalltalk.addMethod(
  14368. "_method_",
  14369. smalltalk.method({
  14370. selector: "method:",
  14371. category: 'accessing',
  14372. fn: function (aCompiledMethod){
  14373. var self=this;
  14374. return smalltalk.withContext(function($ctx1) { self["@method"]=aCompiledMethod;
  14375. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod}, smalltalk.MethodAnnouncement)})},
  14376. args: ["aCompiledMethod"],
  14377. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  14378. messageSends: [],
  14379. referencedClasses: []
  14380. }),
  14381. smalltalk.MethodAnnouncement);
  14382. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  14383. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  14384. smalltalk.addPackage('FileServer', {});
  14385. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'port', 'basePath', 'util', 'username', 'password'], 'FileServer');
  14386. smalltalk.addMethod(
  14387. "_base64Decode_",
  14388. smalltalk.method({
  14389. selector: "base64Decode:",
  14390. category: 'private',
  14391. fn: function (aString){
  14392. var self=this;
  14393. return smalltalk.withContext(function($ctx1) { return (new Buffer(aString, 'base64').toString());
  14394. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString}, smalltalk.FileServer)})},
  14395. args: ["aString"],
  14396. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  14397. messageSends: [],
  14398. referencedClasses: []
  14399. }),
  14400. smalltalk.FileServer);
  14401. smalltalk.addMethod(
  14402. "_basePath",
  14403. smalltalk.method({
  14404. selector: "basePath",
  14405. category: 'accessing',
  14406. fn: function (){
  14407. var self=this;
  14408. return smalltalk.withContext(function($ctx1) { var $2,$1;
  14409. $2=self["@basePath"];
  14410. if(($receiver = $2) == nil || $receiver == undefined){
  14411. $1="./";
  14412. } else {
  14413. $1=$2;
  14414. };
  14415. return $1;
  14416. }, function($ctx1) {$ctx1.fill(self,"basePath",{}, smalltalk.FileServer)})},
  14417. args: [],
  14418. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  14419. messageSends: ["ifNil:"],
  14420. referencedClasses: []
  14421. }),
  14422. smalltalk.FileServer);
  14423. smalltalk.addMethod(
  14424. "_basePath_",
  14425. smalltalk.method({
  14426. selector: "basePath:",
  14427. category: 'accessing',
  14428. fn: function (aString){
  14429. var self=this;
  14430. return smalltalk.withContext(function($ctx1) { self["@basePath"]=aString;
  14431. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString}, smalltalk.FileServer)})},
  14432. args: ["aString"],
  14433. source: "basePath: aString\x0a\x09basePath := aString",
  14434. messageSends: [],
  14435. referencedClasses: []
  14436. }),
  14437. smalltalk.FileServer);
  14438. smalltalk.addMethod(
  14439. "_checkDirectoryLayout",
  14440. smalltalk.method({
  14441. selector: "checkDirectoryLayout",
  14442. category: 'initialization',
  14443. fn: function (){
  14444. var self=this;
  14445. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  14446. $1=_st(self["@path"])._existsSync_(_st(_st(self)._basePath()).__comma("index.html"));
  14447. if(! smalltalk.assert($1)){
  14448. _st(console)._warn_("Warning: project directory does not contain index.html");
  14449. };
  14450. $2=_st(self["@path"])._existsSync_(_st(_st(self)._basePath()).__comma("st"));
  14451. if(! smalltalk.assert($2)){
  14452. _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
  14453. };
  14454. $3=_st(self["@path"])._existsSync_(_st(_st(self)._basePath()).__comma("js"));
  14455. if(! smalltalk.assert($3)){
  14456. _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
  14457. };
  14458. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{}, smalltalk.FileServer)})},
  14459. args: [],
  14460. source: "checkDirectoryLayout\x0a\x09(path existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(path existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(path existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
  14461. messageSends: ["ifFalse:", "warn:", "existsSync:", ",", "basePath"],
  14462. referencedClasses: []
  14463. }),
  14464. smalltalk.FileServer);
  14465. smalltalk.addMethod(
  14466. "_handleGETRequest_respondTo_",
  14467. smalltalk.method({
  14468. selector: "handleGETRequest:respondTo:",
  14469. category: 'request handling',
  14470. fn: function (aRequest,aResponse){
  14471. var self=this;
  14472. var uri,filename;
  14473. return smalltalk.withContext(function($ctx1) { var $1;
  14474. uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
  14475. filename=_st(self["@path"])._join_with_(_st(self)._basePath(),uri);
  14476. _st(self["@path"])._exists_do_(filename,(function(aBoolean){
  14477. return smalltalk.withContext(function($ctx2) { $1=aBoolean;
  14478. if(smalltalk.assert($1)){
  14479. return _st(self)._respondFileNamed_to_(filename,aResponse);
  14480. } else {
  14481. return _st(self)._respondNotFoundTo_(aResponse);
  14482. };
  14483. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1)})}));
  14484. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename}, smalltalk.FileServer)})},
  14485. args: ["aRequest", "aResponse"],
  14486. 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\x09path exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
  14487. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  14488. referencedClasses: []
  14489. }),
  14490. smalltalk.FileServer);
  14491. smalltalk.addMethod(
  14492. "_handleOPTIONSRequest_respondTo_",
  14493. smalltalk.method({
  14494. selector: "handleOPTIONSRequest:respondTo:",
  14495. category: 'request handling',
  14496. fn: function (aRequest,aResponse){
  14497. var self=this;
  14498. 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))]));
  14499. _st(aResponse)._end();
  14500. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse}, smalltalk.FileServer)})},
  14501. args: ["aRequest", "aResponse"],
  14502. 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",
  14503. messageSends: ["writeHead:options:", "->", "end"],
  14504. referencedClasses: []
  14505. }),
  14506. smalltalk.FileServer);
  14507. smalltalk.addMethod(
  14508. "_handlePUTRequest_respondTo_",
  14509. smalltalk.method({
  14510. selector: "handlePUTRequest:respondTo:",
  14511. category: 'request handling',
  14512. fn: function (aRequest,aResponse){
  14513. var self=this;
  14514. var file,stream;
  14515. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14516. $1=_st(self)._isAuthenticated_(aRequest);
  14517. if(! smalltalk.assert($1)){
  14518. _st(self)._respondAuthenticationRequiredTo_(aResponse);
  14519. return nil;
  14520. };
  14521. file=_st(".").__comma(_st(aRequest)._url());
  14522. stream=_st(self["@fs"])._createWriteStream_(file);
  14523. _st(stream)._on_do_("error",(function(error){
  14524. return smalltalk.withContext(function($ctx2) { _st(console)._warn_(_st("Error creating WriteStream for file ").__comma(file));
  14525. _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
  14526. _st(console)._warn_(_st(" The exact error is: ").__comma(error));
  14527. return _st(self)._respondNotCreatedTo_(aResponse);
  14528. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  14529. _st(stream)._on_do_("close",(function(){
  14530. return smalltalk.withContext(function($ctx2) { return _st(self)._respondCreatedTo_(aResponse);
  14531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14532. _st(aRequest)._setEncoding_("utf8");
  14533. _st(aRequest)._on_do_("data",(function(data){
  14534. return smalltalk.withContext(function($ctx2) { return _st(stream)._write_(data);
  14535. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1)})}));
  14536. _st(aRequest)._on_do_("end",(function(){
  14537. return smalltalk.withContext(function($ctx2) { $2=_st(stream)._writable();
  14538. if(smalltalk.assert($2)){
  14539. return _st(stream)._end();
  14540. };
  14541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14542. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream}, smalltalk.FileServer)})},
  14543. args: ["aRequest", "aResponse"],
  14544. 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]]",
  14545. messageSends: ["ifFalse:", "respondAuthenticationRequiredTo:", "isAuthenticated:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "end", "writable"],
  14546. referencedClasses: []
  14547. }),
  14548. smalltalk.FileServer);
  14549. smalltalk.addMethod(
  14550. "_handleRequest_respondTo_",
  14551. smalltalk.method({
  14552. selector: "handleRequest:respondTo:",
  14553. category: 'request handling',
  14554. fn: function (aRequest,aResponse){
  14555. var self=this;
  14556. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  14557. $1=_st(_st(aRequest)._method()).__eq("PUT");
  14558. if(smalltalk.assert($1)){
  14559. _st(self)._handlePUTRequest_respondTo_(aRequest,aResponse);
  14560. };
  14561. $2=_st(_st(aRequest)._method()).__eq("GET");
  14562. if(smalltalk.assert($2)){
  14563. _st(self)._handleGETRequest_respondTo_(aRequest,aResponse);
  14564. };
  14565. $3=_st(_st(aRequest)._method()).__eq("OPTIONS");
  14566. if(smalltalk.assert($3)){
  14567. _st(self)._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  14568. };
  14569. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse}, smalltalk.FileServer)})},
  14570. args: ["aRequest", "aResponse"],
  14571. 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]",
  14572. messageSends: ["ifTrue:", "handlePUTRequest:respondTo:", "=", "method", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  14573. referencedClasses: []
  14574. }),
  14575. smalltalk.FileServer);
  14576. smalltalk.addMethod(
  14577. "_initialize",
  14578. smalltalk.method({
  14579. selector: "initialize",
  14580. category: 'initialization',
  14581. fn: function (){
  14582. var self=this;
  14583. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  14584. self["@path"]=_st(self)._require_("path");
  14585. self["@http"]=_st(self)._require_("http");
  14586. self["@fs"]=_st(self)._require_("fs");
  14587. self["@util"]=_st(self)._require_("util");
  14588. self["@url"]=_st(self)._require_("url");
  14589. self["@port"]=_st(_st(self)._class())._defaultPort();
  14590. self["@username"]=nil;
  14591. self["@password"]=nil;
  14592. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.FileServer)})},
  14593. args: [],
  14594. 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\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.",
  14595. messageSends: ["initialize", "require:", "defaultPort", "class"],
  14596. referencedClasses: []
  14597. }),
  14598. smalltalk.FileServer);
  14599. smalltalk.addMethod(
  14600. "_isAuthenticated_",
  14601. smalltalk.method({
  14602. selector: "isAuthenticated:",
  14603. category: 'private',
  14604. fn: function (aRequest){
  14605. var self=this;
  14606. var header,token,auth,parts;
  14607. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5;
  14608. $1=_st(_st(self["@username"])._isNil())._and_((function(){
  14609. return smalltalk.withContext(function($ctx2) { return _st(self["@password"])._isNil();
  14610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14611. if(smalltalk.assert($1)){
  14612. return true;
  14613. };
  14614. $2=_st(_st(aRequest)._headers())._at_("authorization");
  14615. if(($receiver = $2) == nil || $receiver == undefined){
  14616. header="";
  14617. } else {
  14618. header=$2;
  14619. };
  14620. $3=_st(header)._isEmpty();
  14621. if(smalltalk.assert($3)){
  14622. return false;
  14623. } else {
  14624. $4=_st(header)._tokenize_(" ");
  14625. if(($receiver = $4) == nil || $receiver == undefined){
  14626. token="";
  14627. } else {
  14628. token=$4;
  14629. };
  14630. token;
  14631. auth=_st(self)._base64Decode_(_st(token)._at_((2)));
  14632. auth;
  14633. parts=_st(auth)._tokenize_(":");
  14634. parts;
  14635. $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){
  14636. return smalltalk.withContext(function($ctx2) { return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  14637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14638. if(smalltalk.assert($5)){
  14639. return true;
  14640. } else {
  14641. return false;
  14642. };
  14643. };
  14644. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts}, smalltalk.FileServer)})},
  14645. args: ["aRequest"],
  14646. 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].",
  14647. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "tokenize:", "base64Decode:", "=", "isEmpty"],
  14648. referencedClasses: []
  14649. }),
  14650. smalltalk.FileServer);
  14651. smalltalk.addMethod(
  14652. "_password_",
  14653. smalltalk.method({
  14654. selector: "password:",
  14655. category: 'accessing',
  14656. fn: function (aPassword){
  14657. var self=this;
  14658. return smalltalk.withContext(function($ctx1) { self["@password"]=aPassword;
  14659. return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword}, smalltalk.FileServer)})},
  14660. args: ["aPassword"],
  14661. source: "password: aPassword\x0a\x09password := aPassword.",
  14662. messageSends: [],
  14663. referencedClasses: []
  14664. }),
  14665. smalltalk.FileServer);
  14666. smalltalk.addMethod(
  14667. "_port",
  14668. smalltalk.method({
  14669. selector: "port",
  14670. category: 'accessing',
  14671. fn: function (){
  14672. var self=this;
  14673. return smalltalk.withContext(function($ctx1) { var $1;
  14674. $1=self["@port"];
  14675. return $1;
  14676. }, function($ctx1) {$ctx1.fill(self,"port",{}, smalltalk.FileServer)})},
  14677. args: [],
  14678. source: "port\x0a\x09^port",
  14679. messageSends: [],
  14680. referencedClasses: []
  14681. }),
  14682. smalltalk.FileServer);
  14683. smalltalk.addMethod(
  14684. "_port_",
  14685. smalltalk.method({
  14686. selector: "port:",
  14687. category: 'accessing',
  14688. fn: function (aNumber){
  14689. var self=this;
  14690. return smalltalk.withContext(function($ctx1) { self["@port"]=aNumber;
  14691. return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber}, smalltalk.FileServer)})},
  14692. args: ["aNumber"],
  14693. source: "port: aNumber\x0a\x09port := aNumber",
  14694. messageSends: [],
  14695. referencedClasses: []
  14696. }),
  14697. smalltalk.FileServer);
  14698. smalltalk.addMethod(
  14699. "_require_",
  14700. smalltalk.method({
  14701. selector: "require:",
  14702. category: 'private',
  14703. fn: function (aModuleString){
  14704. var self=this;
  14705. return smalltalk.withContext(function($ctx1) { var $1;
  14706. $1=_st(require)._value_(aModuleString);
  14707. return $1;
  14708. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString}, smalltalk.FileServer)})},
  14709. args: ["aModuleString"],
  14710. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  14711. messageSends: ["value:"],
  14712. referencedClasses: []
  14713. }),
  14714. smalltalk.FileServer);
  14715. smalltalk.addMethod(
  14716. "_respondAuthenticationRequiredTo_",
  14717. smalltalk.method({
  14718. selector: "respondAuthenticationRequiredTo:",
  14719. category: 'request handling',
  14720. fn: function (aResponse){
  14721. var self=this;
  14722. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14723. $1=aResponse;
  14724. _st($1)._writeHead_options_((401),smalltalk.HashedCollection._fromPairs_([_st("WWW-Authenticate").__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
  14725. _st($1)._write_("<html><body>Authentication needed</body></html>");
  14726. $2=_st($1)._end();
  14727. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse}, smalltalk.FileServer)})},
  14728. args: ["aResponse"],
  14729. 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.",
  14730. messageSends: ["writeHead:options:", "->", "write:", "end"],
  14731. referencedClasses: []
  14732. }),
  14733. smalltalk.FileServer);
  14734. smalltalk.addMethod(
  14735. "_respondCreatedTo_",
  14736. smalltalk.method({
  14737. selector: "respondCreatedTo:",
  14738. category: 'request handling',
  14739. fn: function (aResponse){
  14740. var self=this;
  14741. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14742. $1=aResponse;
  14743. _st($1)._writeHead_options_((201),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")]));
  14744. $2=_st($1)._end();
  14745. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse}, smalltalk.FileServer)})},
  14746. args: ["aResponse"],
  14747. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  14748. messageSends: ["writeHead:options:", "->", "end"],
  14749. referencedClasses: []
  14750. }),
  14751. smalltalk.FileServer);
  14752. smalltalk.addMethod(
  14753. "_respondFileNamed_to_",
  14754. smalltalk.method({
  14755. selector: "respondFileNamed:to:",
  14756. category: 'request handling',
  14757. fn: function (aFilename,aResponse){
  14758. var self=this;
  14759. var type,filename;
  14760. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5;
  14761. filename=aFilename;
  14762. $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
  14763. if(smalltalk.assert($1)){
  14764. filename=_st(filename).__comma("index.html");
  14765. filename;
  14766. };
  14767. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  14768. return smalltalk.withContext(function($ctx2) { $2=_st(ex)._notNil();
  14769. if(smalltalk.assert($2)){
  14770. _st(console)._log_(_st(filename).__comma(" does not exist"));
  14771. return _st(self)._respondInternalErrorTo_(aResponse);
  14772. } else {
  14773. type=_st(_st(self)._class())._mimeTypeFor_(filename);
  14774. type;
  14775. $3=_st(type).__eq("application/javascript");
  14776. if(smalltalk.assert($3)){
  14777. type=_st(type).__comma(";charset=utf-8");
  14778. type;
  14779. };
  14780. $4=aResponse;
  14781. _st($4)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt(type)]));
  14782. _st($4)._write_encoding_(file,"binary");
  14783. $5=_st($4)._end();
  14784. return $5;
  14785. };
  14786. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1)})}));
  14787. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename}, smalltalk.FileServer)})},
  14788. args: ["aFilename", "aResponse"],
  14789. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a \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]]",
  14790. messageSends: ["ifTrue:", ",", "isDirectory", "statSync:", "readFile:do:", "ifTrue:ifFalse:", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end", "notNil"],
  14791. referencedClasses: []
  14792. }),
  14793. smalltalk.FileServer);
  14794. smalltalk.addMethod(
  14795. "_respondInternalErrorTo_",
  14796. smalltalk.method({
  14797. selector: "respondInternalErrorTo:",
  14798. category: 'request handling',
  14799. fn: function (aResponse){
  14800. var self=this;
  14801. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14802. $1=aResponse;
  14803. _st($1)._writeHead_options_((500),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
  14804. _st($1)._write_("500 Internal server error");
  14805. $2=_st($1)._end();
  14806. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse}, smalltalk.FileServer)})},
  14807. args: ["aResponse"],
  14808. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  14809. messageSends: ["writeHead:options:", "->", "write:", "end"],
  14810. referencedClasses: []
  14811. }),
  14812. smalltalk.FileServer);
  14813. smalltalk.addMethod(
  14814. "_respondNotCreatedTo_",
  14815. smalltalk.method({
  14816. selector: "respondNotCreatedTo:",
  14817. category: 'request handling',
  14818. fn: function (aResponse){
  14819. var self=this;
  14820. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14821. $1=aResponse;
  14822. _st($1)._writeHead_options_((400),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
  14823. _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
  14824. $2=_st($1)._end();
  14825. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse}, smalltalk.FileServer)})},
  14826. args: ["aResponse"],
  14827. 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.",
  14828. messageSends: ["writeHead:options:", "->", "write:", "end"],
  14829. referencedClasses: []
  14830. }),
  14831. smalltalk.FileServer);
  14832. smalltalk.addMethod(
  14833. "_respondNotFoundTo_",
  14834. smalltalk.method({
  14835. selector: "respondNotFoundTo:",
  14836. category: 'request handling',
  14837. fn: function (aResponse){
  14838. var self=this;
  14839. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14840. $1=aResponse;
  14841. _st($1)._writeHead_options_((404),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain")]));
  14842. _st($1)._write_("404 Not found");
  14843. $2=_st($1)._end();
  14844. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse}, smalltalk.FileServer)})},
  14845. args: ["aResponse"],
  14846. source: "respondNotFoundTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
  14847. messageSends: ["writeHead:options:", "->", "write:", "end"],
  14848. referencedClasses: []
  14849. }),
  14850. smalltalk.FileServer);
  14851. smalltalk.addMethod(
  14852. "_respondOKTo_",
  14853. smalltalk.method({
  14854. selector: "respondOKTo:",
  14855. category: 'request handling',
  14856. fn: function (aResponse){
  14857. var self=this;
  14858. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14859. $1=aResponse;
  14860. _st($1)._writeHead_options_((200),smalltalk.HashedCollection._fromPairs_([_st("Content-Type").__minus_gt("text/plain"),_st("Access-Control-Allow-Origin").__minus_gt("*")]));
  14861. $2=_st($1)._end();
  14862. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse}, smalltalk.FileServer)})},
  14863. args: ["aResponse"],
  14864. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  14865. messageSends: ["writeHead:options:", "->", "end"],
  14866. referencedClasses: []
  14867. }),
  14868. smalltalk.FileServer);
  14869. smalltalk.addMethod(
  14870. "_start",
  14871. smalltalk.method({
  14872. selector: "start",
  14873. category: 'starting',
  14874. fn: function (){
  14875. var self=this;
  14876. return smalltalk.withContext(function($ctx1) { var $1,$2;
  14877. $1=_st(self["@http"])._createServer_((function(request,response){
  14878. return smalltalk.withContext(function($ctx2) { return _st(self)._handleRequest_respondTo_(request,response);
  14879. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1)})}));
  14880. _st($1)._on_do_("error",(function(error){
  14881. return smalltalk.withContext(function($ctx2) { return _st(console)._log_(_st("Error starting server: ").__comma(error));
  14882. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  14883. _st($1)._on_do_("listening",(function(){
  14884. return smalltalk.withContext(function($ctx2) { return _st(console)._log_(_st("Starting file server on port ").__comma(_st(_st(self)._port())._asString()));
  14885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14886. $2=_st($1)._listen_(_st(self)._port());
  14887. return self}, function($ctx1) {$ctx1.fill(self,"start",{}, smalltalk.FileServer)})},
  14888. args: [],
  14889. source: "start\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 port ', self port asString];\x0a\x09 listen: self port.",
  14890. messageSends: ["on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "listen:"],
  14891. referencedClasses: []
  14892. }),
  14893. smalltalk.FileServer);
  14894. smalltalk.addMethod(
  14895. "_startOn_",
  14896. smalltalk.method({
  14897. selector: "startOn:",
  14898. category: 'starting',
  14899. fn: function (aPort){
  14900. var self=this;
  14901. return smalltalk.withContext(function($ctx1) { _st(self)._port_(aPort);
  14902. _st(self)._start();
  14903. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort}, smalltalk.FileServer)})},
  14904. args: ["aPort"],
  14905. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  14906. messageSends: ["port:", "start"],
  14907. referencedClasses: []
  14908. }),
  14909. smalltalk.FileServer);
  14910. smalltalk.addMethod(
  14911. "_username_",
  14912. smalltalk.method({
  14913. selector: "username:",
  14914. category: 'accessing',
  14915. fn: function (aUsername){
  14916. var self=this;
  14917. return smalltalk.withContext(function($ctx1) { self["@username"]=aUsername;
  14918. return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername}, smalltalk.FileServer)})},
  14919. args: ["aUsername"],
  14920. source: "username: aUsername\x0a\x09username := aUsername.",
  14921. messageSends: [],
  14922. referencedClasses: []
  14923. }),
  14924. smalltalk.FileServer);
  14925. smalltalk.addMethod(
  14926. "_username_password_",
  14927. smalltalk.method({
  14928. selector: "username:password:",
  14929. category: 'accessing',
  14930. fn: function (aUsername,aPassword){
  14931. var self=this;
  14932. return smalltalk.withContext(function($ctx1) { self["@username"]=aUsername;
  14933. self["@password"]=aPassword;
  14934. return self}, function($ctx1) {$ctx1.fill(self,"username:password:",{aUsername:aUsername,aPassword:aPassword}, smalltalk.FileServer)})},
  14935. args: ["aUsername", "aPassword"],
  14936. source: "username: aUsername password: aPassword\x0a\x09username := aUsername.\x0a\x09password := aPassword.",
  14937. messageSends: [],
  14938. referencedClasses: []
  14939. }),
  14940. smalltalk.FileServer);
  14941. smalltalk.addMethod(
  14942. "_writeData_toFileNamed_",
  14943. smalltalk.method({
  14944. selector: "writeData:toFileNamed:",
  14945. category: 'private',
  14946. fn: function (data,aFilename){
  14947. var self=this;
  14948. return smalltalk.withContext(function($ctx1) { _st(console)._log_(aFilename);
  14949. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename}, smalltalk.FileServer)})},
  14950. args: ["data", "aFilename"],
  14951. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  14952. messageSends: ["log:"],
  14953. referencedClasses: []
  14954. }),
  14955. smalltalk.FileServer);
  14956. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  14957. smalltalk.addMethod(
  14958. "_commandLineActions",
  14959. smalltalk.method({
  14960. selector: "commandLineActions",
  14961. category: 'accessing',
  14962. fn: function (){
  14963. var self=this;
  14964. return smalltalk.withContext(function($ctx1) { var $1;
  14965. $1=smalltalk.HashedCollection._fromPairs_([_st("-p").__minus_gt((function(fileServer,value){
  14966. return smalltalk.withContext(function($ctx2) { return _st(fileServer)._port_(value);
  14967. }, function($ctx2) {$ctx2.fillBlock({fileServer:fileServer,value:value},$ctx1)})})),_st("--username").__minus_gt((function(fileServer,value){
  14968. return smalltalk.withContext(function($ctx2) { return _st(fileServer)._username_(value);
  14969. }, function($ctx2) {$ctx2.fillBlock({fileServer:fileServer,value:value},$ctx1)})})),_st("--password").__minus_gt((function(fileServer,value){
  14970. return smalltalk.withContext(function($ctx2) { return _st(fileServer)._password_(value);
  14971. }, function($ctx2) {$ctx2.fillBlock({fileServer:fileServer,value:value},$ctx1)})}))]);
  14972. return $1;
  14973. }, function($ctx1) {$ctx1.fill(self,"commandLineActions",{}, smalltalk.FileServer.klass)})},
  14974. args: [],
  14975. source: "commandLineActions\x0a\x09^#{\x0a\x09\x09'-p' -> [:fileServer :value | fileServer port: value].\x0a\x09\x09'--username' -> [:fileServer :value | fileServer username: value].\x0a\x09\x09'--password' -> [:fileServer :value | fileServer password: value]\x0a\x09}",
  14976. messageSends: ["->", "port:", "username:", "password:"],
  14977. referencedClasses: []
  14978. }),
  14979. smalltalk.FileServer.klass);
  14980. smalltalk.addMethod(
  14981. "_createServerWithArguments_",
  14982. smalltalk.method({
  14983. selector: "createServerWithArguments:",
  14984. category: 'initialization',
  14985. fn: function (options){
  14986. var self=this;
  14987. var server,actions,popFront,front,optionName,optionValue;
  14988. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  14989. var $early={};
  14990. try {
  14991. actions=_st((smalltalk.FileServer || FileServer))._commandLineActions();
  14992. popFront=(function(args){
  14993. return smalltalk.withContext(function($ctx2) { front=_st(args)._first();
  14994. front;
  14995. _st(args)._remove_(front);
  14996. return front;
  14997. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})});
  14998. server=_st(self)._new();
  14999. _st(options)._ifEmpty_((function(){
  15000. return smalltalk.withContext(function($ctx2) { $1=server;
  15001. throw $early=[$1];
  15002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15003. $2=_st(_st(options)._size())._even();
  15004. if(! smalltalk.assert($2)){
  15005. _st(console)._log_(_st("Using default parameters. Not enough arguments: ").__comma(options));
  15006. $3=server;
  15007. return $3;
  15008. };
  15009. _st((function(){
  15010. return smalltalk.withContext(function($ctx2) { return _st(options)._notEmpty();
  15011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  15012. return smalltalk.withContext(function($ctx2) { optionName=_st(popFront)._value_(options);
  15013. optionName;
  15014. optionValue=_st(popFront)._value_(options);
  15015. optionValue;
  15016. return _st(_st(actions)._at_ifAbsent_(optionName,(function(){
  15017. return smalltalk.withContext(function($ctx3) { }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._value_value_(server,optionValue);
  15018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15019. $4=server;
  15020. return $4;
  15021. }
  15022. catch(e) {if(e===$early)return e[0]; throw e}
  15023. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,actions:actions,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue}, smalltalk.FileServer.klass)})},
  15024. args: ["options"],
  15025. source: "createServerWithArguments: options\x0a\x09| server actions popFront front optionName optionValue |\x0a\x09actions := FileServer commandLineActions.\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x09(options size even) ifFalse: [console log: 'Using default parameters. Not enough arguments: ' , options. ^server].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x09\x09(actions at: optionName ifAbsent: []) value: server value: optionValue.\x0a\x09].\x0a\x0a\x09^server.",
  15026. messageSends: ["commandLineActions", "first", "remove:", "new", "ifEmpty:", "ifFalse:", "log:", ",", "even", "size", "whileTrue:", "value:", "value:value:", "at:ifAbsent:", "notEmpty"],
  15027. referencedClasses: ["FileServer"]
  15028. }),
  15029. smalltalk.FileServer.klass);
  15030. smalltalk.addMethod(
  15031. "_defaultMimeTypes",
  15032. smalltalk.method({
  15033. selector: "defaultMimeTypes",
  15034. category: 'accessing',
  15035. fn: function (){
  15036. var self=this;
  15037. return smalltalk.withContext(function($ctx1) { var $1;
  15038. $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")]);
  15039. return $1;
  15040. }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{}, smalltalk.FileServer.klass)})},
  15041. args: [],
  15042. 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}",
  15043. messageSends: ["->"],
  15044. referencedClasses: []
  15045. }),
  15046. smalltalk.FileServer.klass);
  15047. smalltalk.addMethod(
  15048. "_defaultPort",
  15049. smalltalk.method({
  15050. selector: "defaultPort",
  15051. category: 'accessing',
  15052. fn: function (){
  15053. var self=this;
  15054. return smalltalk.withContext(function($ctx1) { return (4000);
  15055. }, function($ctx1) {$ctx1.fill(self,"defaultPort",{}, smalltalk.FileServer.klass)})},
  15056. args: [],
  15057. source: "defaultPort\x0a\x09^4000",
  15058. messageSends: [],
  15059. referencedClasses: []
  15060. }),
  15061. smalltalk.FileServer.klass);
  15062. smalltalk.addMethod(
  15063. "_main",
  15064. smalltalk.method({
  15065. selector: "main",
  15066. category: 'initialization',
  15067. fn: function (){
  15068. var self=this;
  15069. var fileServer,args;
  15070. return smalltalk.withContext(function($ctx1) { var $1;
  15071. args=_st(process)._argv();
  15072. _st(args)._removeFrom_to_((1),(3));
  15073. fileServer=_st((smalltalk.FileServer || FileServer))._createServerWithArguments_(args);
  15074. _st(fileServer)._checkDirectoryLayout();
  15075. $1=_st(fileServer)._start();
  15076. return $1;
  15077. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args}, smalltalk.FileServer.klass)})},
  15078. args: [],
  15079. source: "main\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09fileServer := FileServer createServerWithArguments: args.\x0a\x0a\x09fileServer checkDirectoryLayout.\x0a\x09^fileServer start",
  15080. messageSends: ["argv", "removeFrom:to:", "createServerWithArguments:", "checkDirectoryLayout", "start"],
  15081. referencedClasses: ["FileServer"]
  15082. }),
  15083. smalltalk.FileServer.klass);
  15084. smalltalk.addMethod(
  15085. "_mimeTypeFor_",
  15086. smalltalk.method({
  15087. selector: "mimeTypeFor:",
  15088. category: 'accessing',
  15089. fn: function (aString){
  15090. var self=this;
  15091. return smalltalk.withContext(function($ctx1) { var $1;
  15092. $1=_st(_st(self)._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  15093. return smalltalk.withContext(function($ctx2) { return "text/plain";
  15094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15095. return $1;
  15096. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString}, smalltalk.FileServer.klass)})},
  15097. args: ["aString"],
  15098. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  15099. messageSends: ["at:ifAbsent:", "replace:with:", "mimeTypes"],
  15100. referencedClasses: []
  15101. }),
  15102. smalltalk.FileServer.klass);
  15103. smalltalk.addMethod(
  15104. "_mimeTypes",
  15105. smalltalk.method({
  15106. selector: "mimeTypes",
  15107. category: 'accessing',
  15108. fn: function (){
  15109. var self=this;
  15110. return smalltalk.withContext(function($ctx1) { var $2,$1;
  15111. $2=self["@mimeTypes"];
  15112. if(($receiver = $2) == nil || $receiver == undefined){
  15113. self["@mimeTypes"]=_st(self)._defaultMimeTypes();
  15114. $1=self["@mimeTypes"];
  15115. } else {
  15116. $1=$2;
  15117. };
  15118. return $1;
  15119. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{}, smalltalk.FileServer.klass)})},
  15120. args: [],
  15121. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  15122. messageSends: ["ifNil:", "defaultMimeTypes"],
  15123. referencedClasses: []
  15124. }),
  15125. smalltalk.FileServer.klass);
  15126. smalltalk.initialize();
  15127. /* Similar to jQuery(document).ready() */
  15128. if(this.smalltalkReady) {
  15129. this.smalltalkReady();
  15130. }
  15131. smalltalk.FileServer._main()