server.js 415 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885
  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 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. /* Smalltalk constructors definition */
  45. function SmalltalkObject(){}
  46. function SmalltalkBehavior(){}
  47. function SmalltalkClass(){}
  48. function SmalltalkPackage(){}
  49. function SmalltalkMetaclass(){
  50. this.meta = true;
  51. }
  52. function SmalltalkMethod(){}
  53. function SmalltalkNil(){}
  54. function SmalltalkSymbol(string){
  55. this.value = string;
  56. }
  57. function Smalltalk(){
  58. var st = this;
  59. /* This is the current call context object. While it is publicly available,
  60. Use smalltalk.getThisContext() instead which will answer a safe copy of
  61. the current context */
  62. st.thisContext = undefined;
  63. /* List of all reserved words in JavaScript. They may not be used as variables
  64. in Smalltalk. */
  65. st.reservedWords = ['break', 'case', 'catch', 'char', 'class', 'continue', 'debugger',
  66. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  67. 'if', 'in', 'instanceof', 'new', 'private', 'protected',
  68. 'public', 'return', 'static', 'switch', 'this', 'throw',
  69. 'try', 'typeof', 'var', 'void', 'while', 'with', 'yield'];
  70. /* The symbol table ensures symbol unicity */
  71. symbolTable = {};
  72. st.symbolFor = function(string) {
  73. if(symbolTable[string] === undefined) {
  74. symbolTable[string] = new SmalltalkSymbol(string);
  75. };
  76. return symbolTable[string];
  77. };
  78. /* Unique ID number generator */
  79. oid = 0;
  80. st.nextId = function() {
  81. oid += 1;
  82. return oid;
  83. };
  84. /* We hold all Packages in a separate Object */
  85. st.packages = {};
  86. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  87. function pkg(spec) {
  88. var that = new SmalltalkPackage();
  89. that.pkgName = spec.pkgName;
  90. that.properties = spec.properties || {};
  91. return that;
  92. };
  93. /* Smalltalk class creation. A class is an instance of an automatically
  94. created metaclass object. Newly created classes (not their metaclass)
  95. should be added to the smalltalk object, see smalltalk.addClass().
  96. Superclass linking is *not* handled here, see smalltalk.init() */
  97. function klass(spec) {
  98. var spec = spec || {};
  99. var meta = metaclass();
  100. var that = setupClass(meta.instanceClass, spec);
  101. that.className = spec.className;
  102. meta.className = spec.className + ' class';
  103. if(spec.superclass) {
  104. that.superclass = spec.superclass;
  105. meta.superclass = spec.superclass.klass;
  106. }
  107. return that;
  108. }
  109. function metaclass() {
  110. var meta = setupClass(new SmalltalkMetaclass(), {});
  111. meta.instanceClass = new meta.fn;
  112. return meta;
  113. }
  114. function setupClass(that, spec) {
  115. that.fn = spec.fn || function(){};
  116. that.iVarNames = spec.iVarNames || [];
  117. Object.defineProperty(that, "toString", {
  118. value: function() { return 'Smalltalk ' + this.className; },
  119. configurable: true // no writable - in par with ES6 methods
  120. });
  121. that.pkg = spec.pkg;
  122. Object.defineProperties(that.fn.prototype, {
  123. methods: { value: {}, enumerable: false, configurable: true, writable: true },
  124. inheritedMethods: { value: {}, enumerable: false, configurable: true, writable: true },
  125. klass: { value: that, enumerable: false, configurable: true, writable: true }
  126. });
  127. return that;
  128. };
  129. /* Smalltalk method object. To add a method to a class,
  130. use smalltalk.addMethod() */
  131. st.method = function(spec) {
  132. var that = new SmalltalkMethod();
  133. that.selector = spec.selector;
  134. that.jsSelector = spec.jsSelector;
  135. that.args = spec.args || {};
  136. that.category = spec.category;
  137. that.source = spec.source;
  138. that.messageSends = spec.messageSends || [];
  139. that.referencedClasses = spec.referencedClasses || [];
  140. that.fn = spec.fn;
  141. return that;
  142. };
  143. /* Initialize a class in its class hierarchy. Handle both class and
  144. metaclasses. */
  145. st.init = function(klass) {
  146. st.initSubTree(klass);
  147. if(klass.klass && !klass.meta) {
  148. st.initSubTree(klass.klass);
  149. }
  150. };
  151. st.initSubTree = function(klass) {
  152. var subclasses = st.subclasses(klass);
  153. var methods, proto = klass.fn.prototype;
  154. if(klass.superclass && klass.superclass !== nil) {
  155. methods = st.methods(klass.superclass);
  156. //Methods linking
  157. for(var keys=Object.keys(methods),i=0,l=keys.length; i<l; ++i) {
  158. var k = keys[i]
  159. if(!proto.methods[k]) {
  160. proto.inheritedMethods[k] = methods[k];
  161. Object.defineProperty(proto, methods[k].jsSelector, {
  162. value: methods[k].fn, configurable: true // no writable - in par with ES6 methods
  163. });
  164. }
  165. }
  166. }
  167. for(var i=0;i<subclasses.length;i++) {
  168. st.initSubTree(subclasses[i]);
  169. }
  170. };
  171. /* Answer all registered Packages as Array */
  172. st.packages.all = function() {
  173. var packages = [];
  174. for(var i in st.packages) {
  175. if (!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  176. packages.push(st.packages[i]);
  177. }
  178. return packages
  179. };
  180. /* Answer all registered Smalltalk classes */
  181. st.classes = function() {
  182. var classes = [], names = Object.keys(st), l = names.length;
  183. for (var i=0; i<l; ++i) {
  184. var name = names[i];
  185. if (name.search(/^[A-Z]/) !== -1) {
  186. classes.push(st[name]);
  187. }
  188. }
  189. return classes;
  190. };
  191. /* Answer all methods (included inherited ones) of klass. */
  192. st.methods = function(klass) {
  193. var methods = {};
  194. var copyFrom = klass.fn.prototype.methods;
  195. for(var i=0, k=Object.keys(copyFrom), l=k.length; i<l; ++i) {
  196. methods[k[i]] = copyFrom[k[i]];
  197. }
  198. copyFrom = klass.fn.prototype.inheritedMethods;
  199. for(var i=0, k=Object.keys(copyFrom), l=k.length; i<l; ++i) {
  200. methods[k[i]] = copyFrom[k[i]];
  201. }
  202. return methods;
  203. };
  204. /* Answer the direct subclasses of klass. */
  205. st.subclasses = function(klass) {
  206. var subclasses = [];
  207. var classes = st.classes();
  208. for(var i=0, l=classes.length; i<l; ++i) {
  209. var c = classes[i]
  210. if(c.fn) {
  211. //Classes
  212. if(c.superclass === klass) {
  213. subclasses.push(c);
  214. }
  215. c = c.klass;
  216. //Metaclasses
  217. if(c && c.superclass === klass) {
  218. subclasses.push(c);
  219. }
  220. }
  221. }
  222. return subclasses;
  223. };
  224. /* Create a new class wrapping a JavaScript constructor, and add it to the
  225. global smalltalk object. Package is lazily created if it does not exist with given name. */
  226. st.wrapClassName = function(className, pkgName, fn, superclass) {
  227. var pkg = st.addPackage(pkgName);
  228. st[className] = klass({
  229. className: className,
  230. superclass: superclass,
  231. pkg: pkg,
  232. fn: fn
  233. });
  234. };
  235. /* Create an alias for an existing class */
  236. st.alias = function(klass, alias) {
  237. st[alias] = klass;
  238. }
  239. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  240. If pkgName is null or empty we return nil, which is an allowed package for a class.
  241. If package already exists we still update the properties of it. */
  242. st.addPackage = function(pkgName, properties) {
  243. if(!pkgName) {return nil;}
  244. if(!(st.packages[pkgName])) {
  245. st.packages[pkgName] = pkg({
  246. pkgName: pkgName,
  247. properties: properties
  248. });
  249. } else {
  250. if(properties) {
  251. st.packages[pkgName].properties = properties;
  252. }
  253. }
  254. return st.packages[pkgName];
  255. };
  256. /* Add a class to the smalltalk object, creating a new one if needed.
  257. Package is lazily created if it does not exist with given name.*/
  258. st.addClass = function(className, superclass, iVarNames, pkgName) {
  259. var pkg = st.addPackage(pkgName);
  260. if(st[className]) {
  261. st[className].superclass = superclass;
  262. st[className].iVarNames = iVarNames;
  263. st[className].pkg = pkg || st[className].pkg;
  264. } else {
  265. st[className] = klass({
  266. className: className,
  267. superclass: superclass,
  268. pkg: pkg,
  269. iVarNames: iVarNames
  270. });
  271. }
  272. };
  273. /* Add a method to a class */
  274. st.addMethod = function(jsSelector, method, klass) {
  275. Object.defineProperty(klass.fn.prototype, jsSelector, {
  276. value: method.fn, configurable: true // not writable - in par with ES6 methods
  277. });
  278. klass.fn.prototype.methods[method.selector] = method;
  279. method.methodClass = klass;
  280. method.jsSelector = jsSelector;
  281. };
  282. /* Handles unhandled errors during message sends */
  283. st.send = function(receiver, selector, args, klass) {
  284. if(st.thisContext) {
  285. return withContextSend(receiver, selector, args, klass);
  286. } else {
  287. try {return withContextSend(receiver, selector, args, klass)}
  288. catch(error) {
  289. // Reset the context stack in any case
  290. st.thisContext = undefined;
  291. if(error.smalltalkError) {
  292. handleError(error);
  293. } else {
  294. throw(error);
  295. }
  296. }
  297. }
  298. };
  299. function withContextSend(receiver, selector, args, klass) {
  300. var call, imp;
  301. if(receiver == null) {
  302. receiver = nil;
  303. }
  304. imp = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  305. if(imp) {
  306. var context = pushContext(receiver, selector, args);
  307. call = imp.apply(receiver, args);
  308. popContext(context);
  309. return call;
  310. } else {
  311. return messageNotUnderstood(receiver, selector, args);
  312. }
  313. };
  314. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  315. (See the Smalltalk class ErrorHandler and its subclasses */
  316. function handleError(error) {
  317. st.thisContext = undefined;
  318. smalltalk.ErrorHandler._current()._handleError_(error);
  319. };
  320. /* Handles #dnu: *and* JavaScript method calls.
  321. if the receiver has no klass, we consider it a JS object (outside of the
  322. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  323. function messageNotUnderstood(receiver, selector, args) {
  324. /* Handles JS method calls. */
  325. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  326. return callJavaScriptMethod(receiver, selector, args);
  327. }
  328. /* Handles not understood messages. Also see the Amber counter-part
  329. Object>>doesNotUnderstand: */
  330. return receiver._doesNotUnderstand_(
  331. st.Message._new()
  332. ._selector_(st.convertSelector(selector))
  333. ._arguments_(args)
  334. );
  335. };
  336. /* Call a method of a JS object, or answer a property if it exists.
  337. Else try wrapping a JSObjectProxy around the receiver.
  338. If the object property is a function, then call it, except if it starts with
  339. an uppercase character (we probably want to answer the function itself in this
  340. case and send it #new from Amber).
  341. Converts keyword-based selectors by using the first
  342. keyword only, but keeping all message arguments.
  343. Example:
  344. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  345. function callJavaScriptMethod(receiver, selector, args) {
  346. var jsSelector = selector._asJavaScriptSelector();
  347. var jsProperty = receiver[jsSelector];
  348. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  349. return jsProperty.apply(receiver, args);
  350. } else if(jsProperty !== undefined) {
  351. if(args[0]) {
  352. receiver[jsSelector] = args[0];
  353. return nil;
  354. } else {
  355. return jsProperty;
  356. }
  357. }
  358. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  359. };
  360. /* Reuse one old context stored in oldContext */
  361. st.oldContext = null;
  362. /* Handle thisContext pseudo variable */
  363. st.getThisContext = function() {
  364. if(st.thisContext) {
  365. return st.thisContext.copy();
  366. }/* else { // this is the default
  367. return undefined;
  368. }*/
  369. };
  370. function pushContext(receiver, selector, temps) {
  371. var c = st.oldContext, tc = st.thisContext;
  372. if (!c) {
  373. return st.thisContext = new SmalltalkMethodContext(receiver, selector, temps, tc);
  374. }
  375. st.oldContext = null;
  376. c.homeContext = tc;
  377. c.receiver = receiver;
  378. c.selector = selector;
  379. c.temps = temps || {};
  380. return st.thisContext = c;
  381. };
  382. function popContext(context) {
  383. st.thisContext = context.homeContext;
  384. context.homeContext = undefined;
  385. st.oldContext = context;
  386. };
  387. /* Convert a string to a valid smalltalk selector.
  388. if you modify the following functions, also change String>>asSelector
  389. accordingly */
  390. st.convertSelector = function(selector) {
  391. if(selector.match(/__/)) {
  392. return convertBinarySelector(selector);
  393. } else {
  394. return convertKeywordSelector(selector);
  395. }
  396. };
  397. function convertKeywordSelector(selector) {
  398. return selector.replace(/^_/, '').replace(/_/g, ':');
  399. };
  400. function convertBinarySelector(selector) {
  401. return selector
  402. .replace(/^_/, '')
  403. .replace(/_plus/, '+')
  404. .replace(/_minus/, '-')
  405. .replace(/_star/, '*')
  406. .replace(/_slash/, '/')
  407. .replace(/_gt/, '>')
  408. .replace(/_lt/, '<')
  409. .replace(/_eq/, '=')
  410. .replace(/_comma/, ',')
  411. .replace(/_at/, '@')
  412. };
  413. /* Converts a JavaScript object to valid Smalltalk Object */
  414. st.readJSObject = function(js) {
  415. var object = js;
  416. var readObject = (js.constructor === Object);
  417. var readArray = (js.constructor === Array);
  418. if(readObject) {
  419. object = smalltalk.Dictionary._new();
  420. }
  421. for(var i in js) {
  422. if(readObject) {
  423. object._at_put_(i, st.readJSObject(js[i]));
  424. }
  425. if(readArray) {
  426. object[i] = st.readJSObject(js[i]);
  427. }
  428. }
  429. return object;
  430. };
  431. };
  432. function SmalltalkMethodContext(receiver, selector, temps, home) {
  433. this.receiver = receiver;
  434. this.selector = selector;
  435. this.temps = temps || {};
  436. this.homeContext = home;
  437. };
  438. SmalltalkMethodContext.prototype.copy = function() {
  439. var home = this.homeContext;
  440. if(home) {home = home.copy()}
  441. return new SmalltalkMethodContext(
  442. this.receiver,
  443. this.selector,
  444. this.temps,
  445. home
  446. );
  447. };
  448. /* Global Smalltalk objects. */
  449. var nil = new SmalltalkNil();
  450. var smalltalk = new Smalltalk();
  451. if(this.jQuery) {
  452. this.jQuery.allowJavaScriptCalls = true;
  453. }
  454. /****************************************************************************************/
  455. /* Base classes wrapping. If you edit this part, do not forget to set the superclass of the
  456. object metaclass to Class after the definition of Object */
  457. smalltalk.wrapClassName("Object", "Kernel", SmalltalkObject);
  458. smalltalk.wrapClassName("Smalltalk", "Kernel", Smalltalk, smalltalk.Object);
  459. smalltalk.wrapClassName("Package", "Kernel", SmalltalkPackage, smalltalk.Object);
  460. smalltalk.wrapClassName("Behavior", "Kernel", SmalltalkBehavior, smalltalk.Object);
  461. smalltalk.wrapClassName("Class", "Kernel", SmalltalkClass, smalltalk.Behavior);
  462. smalltalk.wrapClassName("Metaclass", "Kernel", SmalltalkMetaclass, smalltalk.Behavior);
  463. smalltalk.wrapClassName("CompiledMethod", "Kernel", SmalltalkMethod, smalltalk.Object);
  464. smalltalk.Object.klass.superclass = smalltalk.Class;
  465. smalltalk.wrapClassName("Number", "Kernel", Number, smalltalk.Object);
  466. smalltalk.wrapClassName("BlockClosure", "Kernel", Function, smalltalk.Object);
  467. smalltalk.wrapClassName("Boolean", "Kernel", Boolean, smalltalk.Object);
  468. smalltalk.wrapClassName("Date", "Kernel", Date, smalltalk.Object);
  469. smalltalk.wrapClassName("UndefinedObject", "Kernel", SmalltalkNil, smalltalk.Object);
  470. smalltalk.wrapClassName("Collection", "Kernel", null, smalltalk.Object);
  471. smalltalk.wrapClassName("SequenceableCollection", "Kernel", null, smalltalk.Collection);
  472. smalltalk.wrapClassName("CharacterArray", "Kernel", null, smalltalk.SequenceableCollection);
  473. smalltalk.wrapClassName("String", "Kernel", String, smalltalk.CharacterArray);
  474. smalltalk.wrapClassName("Symbol", "Kernel", SmalltalkSymbol, smalltalk.CharacterArray);
  475. smalltalk.wrapClassName("Array", "Kernel", Array, smalltalk.SequenceableCollection);
  476. smalltalk.wrapClassName("RegularExpression", "Kernel", RegExp, smalltalk.String);
  477. smalltalk.wrapClassName("Error", "Kernel", Error, smalltalk.Object);
  478. smalltalk.wrapClassName("MethodContext", "Kernel", SmalltalkMethodContext, smalltalk.Object);
  479. /* Alias definitions */
  480. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  481. smalltalk.alias(smalltalk.Date, "Time");
  482. smalltalk.addPackage('Kernel-Objects', {});
  483. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  484. 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."
  485. smalltalk.addMethod(
  486. "__minus_gt",
  487. smalltalk.method({
  488. selector: "->",
  489. category: 'converting',
  490. fn: function (anObject){
  491. var self=this;
  492. return smalltalk.send((smalltalk.Association || Association), "_key_value_", [self, anObject]);
  493. return self;},
  494. args: ["anObject"],
  495. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  496. messageSends: ["key:value:"],
  497. referencedClasses: ["Association"]
  498. }),
  499. smalltalk.Object);
  500. smalltalk.addMethod(
  501. "__eq",
  502. smalltalk.method({
  503. selector: "=",
  504. category: 'comparing',
  505. fn: function (anObject){
  506. var self=this;
  507. return smalltalk.send(self, "__eq_eq", [anObject]);
  508. return self;},
  509. args: ["anObject"],
  510. source: "= anObject\x0a\x09^self == anObject",
  511. messageSends: ["=="],
  512. referencedClasses: []
  513. }),
  514. smalltalk.Object);
  515. smalltalk.addMethod(
  516. "__eq_eq",
  517. smalltalk.method({
  518. selector: "==",
  519. category: 'comparing',
  520. fn: function (anObject){
  521. var self=this;
  522. return smalltalk.send(smalltalk.send(self, "_identityHash", []), "__eq", [smalltalk.send(anObject, "_identityHash", [])]);
  523. return self;},
  524. args: ["anObject"],
  525. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  526. messageSends: ["=", "identityHash"],
  527. referencedClasses: []
  528. }),
  529. smalltalk.Object);
  530. smalltalk.addMethod(
  531. "_asJSON",
  532. smalltalk.method({
  533. selector: "asJSON",
  534. category: 'converting',
  535. fn: function (){
  536. var self=this;
  537. var variables=nil;
  538. (variables=smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_new", []));
  539. smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_allInstanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(variables, "_at_put_", [each, smalltalk.send(smalltalk.send(self, "_instVarAt_", [each]), "_asJSON", [])]);})]);
  540. return variables;
  541. return self;},
  542. args: [],
  543. 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",
  544. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"],
  545. referencedClasses: ["HashedCollection"]
  546. }),
  547. smalltalk.Object);
  548. smalltalk.addMethod(
  549. "_asJSONString",
  550. smalltalk.method({
  551. selector: "asJSONString",
  552. category: 'converting',
  553. fn: function (){
  554. var self=this;
  555. return smalltalk.send((smalltalk.JSON || JSON), "_stringify_", [smalltalk.send(self, "_asJSON", [])]);
  556. return self;},
  557. args: [],
  558. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  559. messageSends: ["stringify:", "asJSON"],
  560. referencedClasses: ["JSON"]
  561. }),
  562. smalltalk.Object);
  563. smalltalk.addMethod(
  564. "_asJavascript",
  565. smalltalk.method({
  566. selector: "asJavascript",
  567. category: 'converting',
  568. fn: function (){
  569. var self=this;
  570. return smalltalk.send(self, "_asString", []);
  571. return self;},
  572. args: [],
  573. source: "asJavascript\x0a\x09^self asString",
  574. messageSends: ["asString"],
  575. referencedClasses: []
  576. }),
  577. smalltalk.Object);
  578. smalltalk.addMethod(
  579. "_asString",
  580. smalltalk.method({
  581. selector: "asString",
  582. category: 'converting',
  583. fn: function (){
  584. var self=this;
  585. return smalltalk.send(self, "_printString", []);
  586. return self;},
  587. args: [],
  588. source: "asString\x0a\x09^self printString",
  589. messageSends: ["printString"],
  590. referencedClasses: []
  591. }),
  592. smalltalk.Object);
  593. smalltalk.addMethod(
  594. "_basicAt_",
  595. smalltalk.method({
  596. selector: "basicAt:",
  597. category: 'accessing',
  598. fn: function (aString){
  599. var self=this;
  600. return self[aString];
  601. return self;},
  602. args: ["aString"],
  603. source: "basicAt: aString\x0a\x09<return self[aString]>",
  604. messageSends: [],
  605. referencedClasses: []
  606. }),
  607. smalltalk.Object);
  608. smalltalk.addMethod(
  609. "_basicAt_put_",
  610. smalltalk.method({
  611. selector: "basicAt:put:",
  612. category: 'accessing',
  613. fn: function (aString, anObject){
  614. var self=this;
  615. return self[aString] = anObject;
  616. return self;},
  617. args: ["aString", "anObject"],
  618. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  619. messageSends: [],
  620. referencedClasses: []
  621. }),
  622. smalltalk.Object);
  623. smalltalk.addMethod(
  624. "_basicDelete_",
  625. smalltalk.method({
  626. selector: "basicDelete:",
  627. category: 'accessing',
  628. fn: function (aString){
  629. var self=this;
  630. delete self[aString]; return aString;
  631. return self;},
  632. args: ["aString"],
  633. source: "basicDelete: aString\x0a <delete self[aString]; return aString>",
  634. messageSends: [],
  635. referencedClasses: []
  636. }),
  637. smalltalk.Object);
  638. smalltalk.addMethod(
  639. "_basicPerform_",
  640. smalltalk.method({
  641. selector: "basicPerform:",
  642. category: 'message handling',
  643. fn: function (aSymbol){
  644. var self=this;
  645. return smalltalk.send(self, "_basicPerform_withArguments_", [aSymbol, []]);
  646. return self;},
  647. args: ["aSymbol"],
  648. source: "basicPerform: aSymbol \x0a\x09^self basicPerform: aSymbol withArguments: #()",
  649. messageSends: ["basicPerform:withArguments:"],
  650. referencedClasses: []
  651. }),
  652. smalltalk.Object);
  653. smalltalk.addMethod(
  654. "_basicPerform_withArguments_",
  655. smalltalk.method({
  656. selector: "basicPerform:withArguments:",
  657. category: 'message handling',
  658. fn: function (aSymbol, aCollection){
  659. var self=this;
  660. return self[aSymbol].apply(self, aCollection);;
  661. return self;},
  662. args: ["aSymbol", "aCollection"],
  663. source: "basicPerform: aSymbol withArguments: aCollection\x0a\x09<return self[aSymbol].apply(self, aCollection);>",
  664. messageSends: [],
  665. referencedClasses: []
  666. }),
  667. smalltalk.Object);
  668. smalltalk.addMethod(
  669. "_class",
  670. smalltalk.method({
  671. selector: "class",
  672. category: 'accessing',
  673. fn: function (){
  674. var self=this;
  675. return self.klass;
  676. return self;},
  677. args: [],
  678. source: "class\x0a\x09<return self.klass>",
  679. messageSends: [],
  680. referencedClasses: []
  681. }),
  682. smalltalk.Object);
  683. smalltalk.addMethod(
  684. "_copy",
  685. smalltalk.method({
  686. selector: "copy",
  687. category: 'copying',
  688. fn: function (){
  689. var self=this;
  690. return smalltalk.send(smalltalk.send(self, "_shallowCopy", []), "_postCopy", []);
  691. return self;},
  692. args: [],
  693. source: "copy\x0a\x09^self shallowCopy postCopy",
  694. messageSends: ["postCopy", "shallowCopy"],
  695. referencedClasses: []
  696. }),
  697. smalltalk.Object);
  698. smalltalk.addMethod(
  699. "_deepCopy",
  700. smalltalk.method({
  701. selector: "deepCopy",
  702. category: 'copying',
  703. fn: function (){
  704. var self=this;
  705. var copy = self.klass._new();
  706. for(var i in self) {
  707. if(/^@.+/.test(i)) {
  708. copy[i] = self[i]._deepCopy();
  709. }
  710. }
  711. return copy;
  712. ;
  713. return self;},
  714. args: [],
  715. 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>",
  716. messageSends: [],
  717. referencedClasses: []
  718. }),
  719. smalltalk.Object);
  720. smalltalk.addMethod(
  721. "_deprecatedAPI",
  722. smalltalk.method({
  723. selector: "deprecatedAPI",
  724. category: 'error handling',
  725. fn: function (){
  726. var self=this;
  727. smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.getThisContext()), "_home", []), "_asString", []), "__comma", [" is deprecated! (in "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.getThisContext()), "_home", []), "_home", []), "_asString", [])]), "__comma", [")"])]);
  728. return self;},
  729. args: [],
  730. 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, ')'",
  731. messageSends: ["warn:", ",", "asString", "home"],
  732. referencedClasses: []
  733. }),
  734. smalltalk.Object);
  735. smalltalk.addMethod(
  736. "_doesNotUnderstand_",
  737. smalltalk.method({
  738. selector: "doesNotUnderstand:",
  739. category: 'error handling',
  740. fn: function (aMessage){
  741. var self=this;
  742. (function($rec){smalltalk.send($rec, "_receiver_", [self]);smalltalk.send($rec, "_message_", [aMessage]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.MessageNotUnderstood || MessageNotUnderstood), "_new", []));
  743. return self;},
  744. args: ["aMessage"],
  745. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  746. messageSends: ["receiver:", "message:", "signal", "new"],
  747. referencedClasses: ["MessageNotUnderstood"]
  748. }),
  749. smalltalk.Object);
  750. smalltalk.addMethod(
  751. "_error_",
  752. smalltalk.method({
  753. selector: "error:",
  754. category: 'error handling',
  755. fn: function (aString){
  756. var self=this;
  757. smalltalk.send((smalltalk.Error || Error), "_signal_", [aString]);
  758. return self;},
  759. args: ["aString"],
  760. source: "error: aString\x0a\x09Error signal: aString",
  761. messageSends: ["signal:"],
  762. referencedClasses: ["Error"]
  763. }),
  764. smalltalk.Object);
  765. smalltalk.addMethod(
  766. "_halt",
  767. smalltalk.method({
  768. selector: "halt",
  769. category: 'error handling',
  770. fn: function (){
  771. var self=this;
  772. smalltalk.send(self, "_error_", ["Halt encountered"]);
  773. return self;},
  774. args: [],
  775. source: "halt\x0a\x09self error: 'Halt encountered'",
  776. messageSends: ["error:"],
  777. referencedClasses: []
  778. }),
  779. smalltalk.Object);
  780. smalltalk.addMethod(
  781. "_identityHash",
  782. smalltalk.method({
  783. selector: "identityHash",
  784. category: 'accessing',
  785. fn: function (){
  786. var self=this;
  787. var hash=self.identityHash;
  788. if (hash) return hash;
  789. hash=smalltalk.nextId();
  790. Object.defineProperty(self, 'identityHash', {value:hash});
  791. return hash;
  792. ;
  793. return self;},
  794. args: [],
  795. 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>",
  796. messageSends: [],
  797. referencedClasses: []
  798. }),
  799. smalltalk.Object);
  800. smalltalk.addMethod(
  801. "_ifNil_",
  802. smalltalk.method({
  803. selector: "ifNil:",
  804. category: 'testing',
  805. fn: function (aBlock){
  806. var self=this;
  807. return self;
  808. return self;},
  809. args: ["aBlock"],
  810. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  811. messageSends: [],
  812. referencedClasses: []
  813. }),
  814. smalltalk.Object);
  815. smalltalk.addMethod(
  816. "_ifNil_ifNotNil_",
  817. smalltalk.method({
  818. selector: "ifNil:ifNotNil:",
  819. category: 'testing',
  820. fn: function (aBlock, anotherBlock){
  821. var self=this;
  822. return smalltalk.send(anotherBlock, "_value", []);
  823. return self;},
  824. args: ["aBlock", "anotherBlock"],
  825. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  826. messageSends: ["value"],
  827. referencedClasses: []
  828. }),
  829. smalltalk.Object);
  830. smalltalk.addMethod(
  831. "_ifNotNil_",
  832. smalltalk.method({
  833. selector: "ifNotNil:",
  834. category: 'testing',
  835. fn: function (aBlock){
  836. var self=this;
  837. return smalltalk.send(aBlock, "_value", []);
  838. return self;},
  839. args: ["aBlock"],
  840. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  841. messageSends: ["value"],
  842. referencedClasses: []
  843. }),
  844. smalltalk.Object);
  845. smalltalk.addMethod(
  846. "_ifNotNil_ifNil_",
  847. smalltalk.method({
  848. selector: "ifNotNil:ifNil:",
  849. category: 'testing',
  850. fn: function (aBlock, anotherBlock){
  851. var self=this;
  852. return smalltalk.send(aBlock, "_value", []);
  853. return self;},
  854. args: ["aBlock", "anotherBlock"],
  855. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  856. messageSends: ["value"],
  857. referencedClasses: []
  858. }),
  859. smalltalk.Object);
  860. smalltalk.addMethod(
  861. "_initialize",
  862. smalltalk.method({
  863. selector: "initialize",
  864. category: 'initialization',
  865. fn: function (){
  866. var self=this;
  867. return self;},
  868. args: [],
  869. source: "initialize",
  870. messageSends: [],
  871. referencedClasses: []
  872. }),
  873. smalltalk.Object);
  874. smalltalk.addMethod(
  875. "_instVarAt_",
  876. smalltalk.method({
  877. selector: "instVarAt:",
  878. category: 'accessing',
  879. fn: function (aSymbol){
  880. var self=this;
  881. var varname=nil;
  882. (varname=smalltalk.send(aSymbol, "_asString", []));
  883. return self['@'+varname];
  884. return self;},
  885. args: ["aSymbol"],
  886. source: "instVarAt: aSymbol\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<return self['@'+varname]>",
  887. messageSends: ["asString"],
  888. referencedClasses: []
  889. }),
  890. smalltalk.Object);
  891. smalltalk.addMethod(
  892. "_instVarAt_put_",
  893. smalltalk.method({
  894. selector: "instVarAt:put:",
  895. category: 'accessing',
  896. fn: function (aSymbol, anObject){
  897. var self=this;
  898. var varname=nil;
  899. (varname=smalltalk.send(aSymbol, "_asString", []));
  900. self['@' + varname] = anObject;
  901. return self;},
  902. args: ["aSymbol", "anObject"],
  903. source: "instVarAt: aSymbol put: anObject\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<self['@' + varname] = anObject>",
  904. messageSends: ["asString"],
  905. referencedClasses: []
  906. }),
  907. smalltalk.Object);
  908. smalltalk.addMethod(
  909. "_isClass",
  910. smalltalk.method({
  911. selector: "isClass",
  912. category: 'testing',
  913. fn: function (){
  914. var self=this;
  915. return false;
  916. return self;},
  917. args: [],
  918. source: "isClass\x0a\x09^false",
  919. messageSends: [],
  920. referencedClasses: []
  921. }),
  922. smalltalk.Object);
  923. smalltalk.addMethod(
  924. "_isKindOf_",
  925. smalltalk.method({
  926. selector: "isKindOf:",
  927. category: 'testing',
  928. fn: function (aClass){
  929. var self=this;
  930. return ((($receiver = smalltalk.send(self, "_isMemberOf_", [aClass])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return true;})() : (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return true;}), (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);})]));
  931. return self;},
  932. args: ["aClass"],
  933. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: [self class inheritsFrom: aClass]",
  934. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
  935. referencedClasses: []
  936. }),
  937. smalltalk.Object);
  938. smalltalk.addMethod(
  939. "_isMemberOf_",
  940. smalltalk.method({
  941. selector: "isMemberOf:",
  942. category: 'testing',
  943. fn: function (aClass){
  944. var self=this;
  945. return smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [aClass]);
  946. return self;},
  947. args: ["aClass"],
  948. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  949. messageSends: ["=", "class"],
  950. referencedClasses: []
  951. }),
  952. smalltalk.Object);
  953. smalltalk.addMethod(
  954. "_isMetaclass",
  955. smalltalk.method({
  956. selector: "isMetaclass",
  957. category: 'testing',
  958. fn: function (){
  959. var self=this;
  960. return false;
  961. return self;},
  962. args: [],
  963. source: "isMetaclass\x0a\x09^false",
  964. messageSends: [],
  965. referencedClasses: []
  966. }),
  967. smalltalk.Object);
  968. smalltalk.addMethod(
  969. "_isNil",
  970. smalltalk.method({
  971. selector: "isNil",
  972. category: 'testing',
  973. fn: function (){
  974. var self=this;
  975. return false;
  976. return self;},
  977. args: [],
  978. source: "isNil\x0a\x09^false",
  979. messageSends: [],
  980. referencedClasses: []
  981. }),
  982. smalltalk.Object);
  983. smalltalk.addMethod(
  984. "_isNumber",
  985. smalltalk.method({
  986. selector: "isNumber",
  987. category: 'testing',
  988. fn: function (){
  989. var self=this;
  990. return false;
  991. return self;},
  992. args: [],
  993. source: "isNumber\x0a\x09^false",
  994. messageSends: [],
  995. referencedClasses: []
  996. }),
  997. smalltalk.Object);
  998. smalltalk.addMethod(
  999. "_isParseFailure",
  1000. smalltalk.method({
  1001. selector: "isParseFailure",
  1002. category: 'testing',
  1003. fn: function (){
  1004. var self=this;
  1005. return false;
  1006. return self;},
  1007. args: [],
  1008. source: "isParseFailure\x0a\x09^false",
  1009. messageSends: [],
  1010. referencedClasses: []
  1011. }),
  1012. smalltalk.Object);
  1013. smalltalk.addMethod(
  1014. "_isString",
  1015. smalltalk.method({
  1016. selector: "isString",
  1017. category: 'testing',
  1018. fn: function (){
  1019. var self=this;
  1020. return false;
  1021. return self;},
  1022. args: [],
  1023. source: "isString\x0a\x09^false",
  1024. messageSends: [],
  1025. referencedClasses: []
  1026. }),
  1027. smalltalk.Object);
  1028. smalltalk.addMethod(
  1029. "_isSymbol",
  1030. smalltalk.method({
  1031. selector: "isSymbol",
  1032. category: 'testing',
  1033. fn: function (){
  1034. var self=this;
  1035. return false;
  1036. return self;},
  1037. args: [],
  1038. source: "isSymbol\x0a\x09^false",
  1039. messageSends: [],
  1040. referencedClasses: []
  1041. }),
  1042. smalltalk.Object);
  1043. smalltalk.addMethod(
  1044. "_log_block_",
  1045. smalltalk.method({
  1046. selector: "log:block:",
  1047. category: 'printing',
  1048. fn: function (aString, aBlock){
  1049. var self=this;
  1050. var result=nil;
  1051. smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(smalltalk.send(aString, "__comma", [" time: "]), "__comma", [smalltalk.send(smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (result=smalltalk.send(aBlock, "_value", []));})]), "_printString", [])])]);
  1052. return result;
  1053. return self;},
  1054. args: ["aString", "aBlock"],
  1055. source: "log: aString block: aBlock\x0a\x0a\x09| result |\x0a\x09console log: aString, ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.\x0a\x09^result",
  1056. messageSends: ["log:", ",", "printString", "millisecondsToRun:", "value"],
  1057. referencedClasses: ["Date"]
  1058. }),
  1059. smalltalk.Object);
  1060. smalltalk.addMethod(
  1061. "_notNil",
  1062. smalltalk.method({
  1063. selector: "notNil",
  1064. category: 'testing',
  1065. fn: function (){
  1066. var self=this;
  1067. return smalltalk.send(smalltalk.send(self, "_isNil", []), "_not", []);
  1068. return self;},
  1069. args: [],
  1070. source: "notNil\x0a\x09^self isNil not",
  1071. messageSends: ["not", "isNil"],
  1072. referencedClasses: []
  1073. }),
  1074. smalltalk.Object);
  1075. smalltalk.addMethod(
  1076. "_perform_",
  1077. smalltalk.method({
  1078. selector: "perform:",
  1079. category: 'message handling',
  1080. fn: function (aSymbol){
  1081. var self=this;
  1082. return smalltalk.send(self, "_perform_withArguments_", [aSymbol, []]);
  1083. return self;},
  1084. args: ["aSymbol"],
  1085. source: "perform: aSymbol\x0a\x09^self perform: aSymbol withArguments: #()",
  1086. messageSends: ["perform:withArguments:"],
  1087. referencedClasses: []
  1088. }),
  1089. smalltalk.Object);
  1090. smalltalk.addMethod(
  1091. "_perform_withArguments_",
  1092. smalltalk.method({
  1093. selector: "perform:withArguments:",
  1094. category: 'message handling',
  1095. fn: function (aSymbol, aCollection){
  1096. var self=this;
  1097. var selector=nil;
  1098. (selector=smalltalk.send(aSymbol, "_asSelector", []));
  1099. return smalltalk.send(self, selector, aCollection);
  1100. return self;},
  1101. args: ["aSymbol", "aCollection"],
  1102. source: "perform: aSymbol withArguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSymbol asSelector.\x0a\x09<return smalltalk.send(self, selector, aCollection)>",
  1103. messageSends: ["asSelector"],
  1104. referencedClasses: []
  1105. }),
  1106. smalltalk.Object);
  1107. smalltalk.addMethod(
  1108. "_postCopy",
  1109. smalltalk.method({
  1110. selector: "postCopy",
  1111. category: 'copying',
  1112. fn: function (){
  1113. var self=this;
  1114. return self;},
  1115. args: [],
  1116. source: "postCopy",
  1117. messageSends: [],
  1118. referencedClasses: []
  1119. }),
  1120. smalltalk.Object);
  1121. smalltalk.addMethod(
  1122. "_printNl",
  1123. smalltalk.method({
  1124. selector: "printNl",
  1125. category: 'printing',
  1126. fn: function (){
  1127. var self=this;
  1128. console.log(self);
  1129. return self;},
  1130. args: [],
  1131. source: "printNl\x0a\x09<console.log(self)>",
  1132. messageSends: [],
  1133. referencedClasses: []
  1134. }),
  1135. smalltalk.Object);
  1136. smalltalk.addMethod(
  1137. "_printString",
  1138. smalltalk.method({
  1139. selector: "printString",
  1140. category: 'printing',
  1141. fn: function (){
  1142. var self=this;
  1143. return smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]);
  1144. return self;},
  1145. args: [],
  1146. source: "printString\x0a\x09^'a ', self class name",
  1147. messageSends: [",", "name", "class"],
  1148. referencedClasses: []
  1149. }),
  1150. smalltalk.Object);
  1151. smalltalk.addMethod(
  1152. "_respondsTo_",
  1153. smalltalk.method({
  1154. selector: "respondsTo:",
  1155. category: 'testing',
  1156. fn: function (aSelector){
  1157. var self=this;
  1158. return smalltalk.send(smalltalk.send(self, "_class", []), "_canUnderstand_", [aSelector]);
  1159. return self;},
  1160. args: ["aSelector"],
  1161. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1162. messageSends: ["canUnderstand:", "class"],
  1163. referencedClasses: []
  1164. }),
  1165. smalltalk.Object);
  1166. smalltalk.addMethod(
  1167. "_shallowCopy",
  1168. smalltalk.method({
  1169. selector: "shallowCopy",
  1170. category: 'copying',
  1171. fn: function (){
  1172. var self=this;
  1173. var copy = self.klass._new();
  1174. for(var i in self) {
  1175. if(/^@.+/.test(i)) {
  1176. copy[i] = self[i];
  1177. }
  1178. }
  1179. return copy;
  1180. ;
  1181. return self;},
  1182. args: [],
  1183. 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>",
  1184. messageSends: [],
  1185. referencedClasses: []
  1186. }),
  1187. smalltalk.Object);
  1188. smalltalk.addMethod(
  1189. "_shouldNotImplement",
  1190. smalltalk.method({
  1191. selector: "shouldNotImplement",
  1192. category: 'error handling',
  1193. fn: function (){
  1194. var self=this;
  1195. smalltalk.send(self, "_error_", [smalltalk.send("This method should not be implemented in ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])])]);
  1196. return self;},
  1197. args: [],
  1198. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1199. messageSends: ["error:", ",", "name", "class"],
  1200. referencedClasses: []
  1201. }),
  1202. smalltalk.Object);
  1203. smalltalk.addMethod(
  1204. "_size",
  1205. smalltalk.method({
  1206. selector: "size",
  1207. category: 'accessing',
  1208. fn: function (){
  1209. var self=this;
  1210. smalltalk.send(self, "_error_", ["Object not indexable"]);
  1211. return self;},
  1212. args: [],
  1213. source: "size\x0a\x09self error: 'Object not indexable'",
  1214. messageSends: ["error:"],
  1215. referencedClasses: []
  1216. }),
  1217. smalltalk.Object);
  1218. smalltalk.addMethod(
  1219. "_storeOn_",
  1220. smalltalk.method({
  1221. selector: "storeOn:",
  1222. category: 'printing',
  1223. fn: function (aStream){
  1224. var self=this;
  1225. smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [])]);
  1226. return self;},
  1227. args: ["aStream"],
  1228. source: "storeOn: aStream\x0a\x09aStream nextPutAll: self printString",
  1229. messageSends: ["nextPutAll:", "printString"],
  1230. referencedClasses: []
  1231. }),
  1232. smalltalk.Object);
  1233. smalltalk.addMethod(
  1234. "_storeString",
  1235. smalltalk.method({
  1236. selector: "storeString",
  1237. category: 'printing',
  1238. fn: function (){
  1239. var self=this;
  1240. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(s){return smalltalk.send(self, "_storeOn_", [s]);})]);
  1241. return self;},
  1242. args: [],
  1243. 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]",
  1244. messageSends: ["streamContents:", "storeOn:"],
  1245. referencedClasses: ["String"]
  1246. }),
  1247. smalltalk.Object);
  1248. smalltalk.addMethod(
  1249. "_subclassResponsibility",
  1250. smalltalk.method({
  1251. selector: "subclassResponsibility",
  1252. category: 'error handling',
  1253. fn: function (){
  1254. var self=this;
  1255. smalltalk.send(self, "_error_", ["This method is a responsibility of a subclass"]);
  1256. return self;},
  1257. args: [],
  1258. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1259. messageSends: ["error:"],
  1260. referencedClasses: []
  1261. }),
  1262. smalltalk.Object);
  1263. smalltalk.addMethod(
  1264. "_try_catch_",
  1265. smalltalk.method({
  1266. selector: "try:catch:",
  1267. category: 'error handling',
  1268. fn: function (aBlock, anotherBlock){
  1269. var self=this;
  1270. try{result = aBlock()} catch(e) {result = anotherBlock(e)};
  1271. return result;;
  1272. return self;},
  1273. args: ["aBlock", "anotherBlock"],
  1274. source: "try: aBlock catch: anotherBlock\x0a\x09<try{result = aBlock()} catch(e) {result = anotherBlock(e)};\x0a\x09return result;>",
  1275. messageSends: [],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.Object);
  1279. smalltalk.addMethod(
  1280. "_yourself",
  1281. smalltalk.method({
  1282. selector: "yourself",
  1283. category: 'accessing',
  1284. fn: function (){
  1285. var self=this;
  1286. return self;
  1287. return self;},
  1288. args: [],
  1289. source: "yourself\x0a\x09^self",
  1290. messageSends: [],
  1291. referencedClasses: []
  1292. }),
  1293. smalltalk.Object);
  1294. smalltalk.addMethod(
  1295. "_~_eq",
  1296. smalltalk.method({
  1297. selector: "~=",
  1298. category: 'comparing',
  1299. fn: function (anObject){
  1300. var self=this;
  1301. return smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq", [false]);
  1302. return self;},
  1303. args: ["anObject"],
  1304. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1305. messageSends: ["="],
  1306. referencedClasses: []
  1307. }),
  1308. smalltalk.Object);
  1309. smalltalk.addMethod(
  1310. "_~~",
  1311. smalltalk.method({
  1312. selector: "~~",
  1313. category: 'comparing',
  1314. fn: function (anObject){
  1315. var self=this;
  1316. return smalltalk.send(smalltalk.send(self, "__eq_eq", [anObject]), "__eq", [false]);
  1317. return self;},
  1318. args: ["anObject"],
  1319. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1320. messageSends: ["=", "=="],
  1321. referencedClasses: []
  1322. }),
  1323. smalltalk.Object);
  1324. smalltalk.addMethod(
  1325. "_initialize",
  1326. smalltalk.method({
  1327. selector: "initialize",
  1328. category: 'initialization',
  1329. fn: function (){
  1330. var self=this;
  1331. return self;},
  1332. args: [],
  1333. source: "initialize\x0a\x09\x22no op\x22",
  1334. messageSends: [],
  1335. referencedClasses: []
  1336. }),
  1337. smalltalk.Object.klass);
  1338. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1339. 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`."
  1340. smalltalk.addMethod(
  1341. "_&",
  1342. smalltalk.method({
  1343. selector: "&",
  1344. category: 'controlling',
  1345. fn: function (aBoolean){
  1346. var self=this;
  1347. if(self == true) {
  1348. return aBoolean;
  1349. } else {
  1350. return false;
  1351. }
  1352. ;
  1353. return self;},
  1354. args: ["aBoolean"],
  1355. source: "& aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09 } else {\x0a\x09\x09return false;\x0a\x09 }\x0a\x09>",
  1356. messageSends: [],
  1357. referencedClasses: []
  1358. }),
  1359. smalltalk.Boolean);
  1360. smalltalk.addMethod(
  1361. "__eq",
  1362. smalltalk.method({
  1363. selector: "=",
  1364. category: 'comparing',
  1365. fn: function (aBoolean){
  1366. var self=this;
  1367. var $early={};
  1368. try{((($receiver = smalltalk.send(smalltalk.send(aBoolean, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  1369. return Boolean(self == true) == aBoolean;
  1370. return self;
  1371. } catch(e) {if(e===$early)return e[0]; throw e}},
  1372. args: ["aBoolean"],
  1373. source: "= aBoolean\x0a\x09aBoolean class = self class ifFalse: [^false].\x0a\x09<return Boolean(self == true) == aBoolean>",
  1374. messageSends: ["ifFalse:", "=", "class"],
  1375. referencedClasses: []
  1376. }),
  1377. smalltalk.Boolean);
  1378. smalltalk.addMethod(
  1379. "__eq_eq",
  1380. smalltalk.method({
  1381. selector: "==",
  1382. category: 'comparing',
  1383. fn: function (aBoolean){
  1384. var self=this;
  1385. return smalltalk.send(self, "__eq", [aBoolean]);
  1386. return self;},
  1387. args: ["aBoolean"],
  1388. source: "== aBoolean\x0a\x09^self = aBoolean",
  1389. messageSends: ["="],
  1390. referencedClasses: []
  1391. }),
  1392. smalltalk.Boolean);
  1393. smalltalk.addMethod(
  1394. "_and_",
  1395. smalltalk.method({
  1396. selector: "and:",
  1397. category: 'controlling',
  1398. fn: function (aBlock){
  1399. var self=this;
  1400. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [aBlock, (function(){return false;})]);
  1401. return self;},
  1402. args: ["aBlock"],
  1403. source: "and: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: aBlock\x0a\x09 ifFalse: [false]",
  1404. messageSends: ["ifTrue:ifFalse:", "="],
  1405. referencedClasses: []
  1406. }),
  1407. smalltalk.Boolean);
  1408. smalltalk.addMethod(
  1409. "_asJSON",
  1410. smalltalk.method({
  1411. selector: "asJSON",
  1412. category: 'converting',
  1413. fn: function (){
  1414. var self=this;
  1415. return self;
  1416. return self;},
  1417. args: [],
  1418. source: "asJSON\x0a\x09^self",
  1419. messageSends: [],
  1420. referencedClasses: []
  1421. }),
  1422. smalltalk.Boolean);
  1423. smalltalk.addMethod(
  1424. "_deepCopy",
  1425. smalltalk.method({
  1426. selector: "deepCopy",
  1427. category: 'copying',
  1428. fn: function (){
  1429. var self=this;
  1430. return self;
  1431. return self;},
  1432. args: [],
  1433. source: "deepCopy\x0a\x09^self",
  1434. messageSends: [],
  1435. referencedClasses: []
  1436. }),
  1437. smalltalk.Boolean);
  1438. smalltalk.addMethod(
  1439. "_ifFalse_",
  1440. smalltalk.method({
  1441. selector: "ifFalse:",
  1442. category: 'controlling',
  1443. fn: function (aBlock){
  1444. var self=this;
  1445. return smalltalk.send(self, "_ifTrue_ifFalse_", [(function(){return nil;}), aBlock]);
  1446. return self;},
  1447. args: ["aBlock"],
  1448. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1449. messageSends: ["ifTrue:ifFalse:"],
  1450. referencedClasses: []
  1451. }),
  1452. smalltalk.Boolean);
  1453. smalltalk.addMethod(
  1454. "_ifFalse_ifTrue_",
  1455. smalltalk.method({
  1456. selector: "ifFalse:ifTrue:",
  1457. category: 'controlling',
  1458. fn: function (aBlock, anotherBlock){
  1459. var self=this;
  1460. return smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  1461. return self;},
  1462. args: ["aBlock", "anotherBlock"],
  1463. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1464. messageSends: ["ifTrue:ifFalse:"],
  1465. referencedClasses: []
  1466. }),
  1467. smalltalk.Boolean);
  1468. smalltalk.addMethod(
  1469. "_ifTrue_",
  1470. smalltalk.method({
  1471. selector: "ifTrue:",
  1472. category: 'controlling',
  1473. fn: function (aBlock){
  1474. var self=this;
  1475. return smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, (function(){return nil;})]);
  1476. return self;},
  1477. args: ["aBlock"],
  1478. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1479. messageSends: ["ifTrue:ifFalse:"],
  1480. referencedClasses: []
  1481. }),
  1482. smalltalk.Boolean);
  1483. smalltalk.addMethod(
  1484. "_ifTrue_ifFalse_",
  1485. smalltalk.method({
  1486. selector: "ifTrue:ifFalse:",
  1487. category: 'controlling',
  1488. fn: function (aBlock, anotherBlock){
  1489. var self=this;
  1490. if(self == true) {
  1491. return aBlock();
  1492. } else {
  1493. return anotherBlock();
  1494. }
  1495. ;
  1496. return self;},
  1497. args: ["aBlock", "anotherBlock"],
  1498. 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>",
  1499. messageSends: [],
  1500. referencedClasses: []
  1501. }),
  1502. smalltalk.Boolean);
  1503. smalltalk.addMethod(
  1504. "_not",
  1505. smalltalk.method({
  1506. selector: "not",
  1507. category: 'controlling',
  1508. fn: function (){
  1509. var self=this;
  1510. return smalltalk.send(self, "__eq", [false]);
  1511. return self;},
  1512. args: [],
  1513. source: "not\x0a\x09^self = false",
  1514. messageSends: ["="],
  1515. referencedClasses: []
  1516. }),
  1517. smalltalk.Boolean);
  1518. smalltalk.addMethod(
  1519. "_or_",
  1520. smalltalk.method({
  1521. selector: "or:",
  1522. category: 'controlling',
  1523. fn: function (aBlock){
  1524. var self=this;
  1525. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [(function(){return true;}), aBlock]);
  1526. return self;},
  1527. args: ["aBlock"],
  1528. source: "or: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: aBlock",
  1529. messageSends: ["ifTrue:ifFalse:", "="],
  1530. referencedClasses: []
  1531. }),
  1532. smalltalk.Boolean);
  1533. smalltalk.addMethod(
  1534. "_printString",
  1535. smalltalk.method({
  1536. selector: "printString",
  1537. category: 'printing',
  1538. fn: function (){
  1539. var self=this;
  1540. return self.toString();
  1541. return self;},
  1542. args: [],
  1543. source: "printString\x0a\x09<return self.toString()>",
  1544. messageSends: [],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.Boolean);
  1548. smalltalk.addMethod(
  1549. "_shallowCopy",
  1550. smalltalk.method({
  1551. selector: "shallowCopy",
  1552. category: 'copying',
  1553. fn: function (){
  1554. var self=this;
  1555. return self;
  1556. return self;},
  1557. args: [],
  1558. source: "shallowCopy\x0a\x09^self",
  1559. messageSends: [],
  1560. referencedClasses: []
  1561. }),
  1562. smalltalk.Boolean);
  1563. smalltalk.addMethod(
  1564. "_|",
  1565. smalltalk.method({
  1566. selector: "|",
  1567. category: 'controlling',
  1568. fn: function (aBoolean){
  1569. var self=this;
  1570. if(self == true) {
  1571. return true;
  1572. } else {
  1573. return aBoolean;
  1574. }
  1575. ;
  1576. return self;},
  1577. args: ["aBoolean"],
  1578. source: "| aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return true;\x0a\x09 } else {\x0a\x09\x09return aBoolean;\x0a\x09 }\x0a\x09>",
  1579. messageSends: [],
  1580. referencedClasses: []
  1581. }),
  1582. smalltalk.Boolean);
  1583. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1584. 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."
  1585. smalltalk.addMethod(
  1586. "__plus",
  1587. smalltalk.method({
  1588. selector: "+",
  1589. category: 'arithmetic',
  1590. fn: function (aDate){
  1591. var self=this;
  1592. return self + aDate;
  1593. return self;},
  1594. args: ["aDate"],
  1595. source: "+ aDate\x0a\x09<return self + aDate>",
  1596. messageSends: [],
  1597. referencedClasses: []
  1598. }),
  1599. smalltalk.Date);
  1600. smalltalk.addMethod(
  1601. "__minus",
  1602. smalltalk.method({
  1603. selector: "-",
  1604. category: 'arithmetic',
  1605. fn: function (aDate){
  1606. var self=this;
  1607. return self - aDate;
  1608. return self;},
  1609. args: ["aDate"],
  1610. source: "- aDate\x0a\x09<return self - aDate>",
  1611. messageSends: [],
  1612. referencedClasses: []
  1613. }),
  1614. smalltalk.Date);
  1615. smalltalk.addMethod(
  1616. "__lt",
  1617. smalltalk.method({
  1618. selector: "<",
  1619. category: 'comparing',
  1620. fn: function (aDate){
  1621. var self=this;
  1622. return self < aDate;
  1623. return self;},
  1624. args: ["aDate"],
  1625. source: "< aDate\x0a\x09<return self < aDate>",
  1626. messageSends: [],
  1627. referencedClasses: []
  1628. }),
  1629. smalltalk.Date);
  1630. smalltalk.addMethod(
  1631. "__lt_eq",
  1632. smalltalk.method({
  1633. selector: "<=",
  1634. category: 'comparing',
  1635. fn: function (aDate){
  1636. var self=this;
  1637. return self <= aDate;
  1638. return self;},
  1639. args: ["aDate"],
  1640. source: "<= aDate\x0a\x09<return self <= aDate>",
  1641. messageSends: [],
  1642. referencedClasses: []
  1643. }),
  1644. smalltalk.Date);
  1645. smalltalk.addMethod(
  1646. "__gt",
  1647. smalltalk.method({
  1648. selector: ">",
  1649. category: 'comparing',
  1650. fn: function (aDate){
  1651. var self=this;
  1652. return self > aDate;
  1653. return self;},
  1654. args: ["aDate"],
  1655. source: "> aDate\x0a\x09<return self >> aDate>",
  1656. messageSends: [],
  1657. referencedClasses: []
  1658. }),
  1659. smalltalk.Date);
  1660. smalltalk.addMethod(
  1661. "__gt_eq",
  1662. smalltalk.method({
  1663. selector: ">=",
  1664. category: 'comparing',
  1665. fn: function (aDate){
  1666. var self=this;
  1667. return self >= aDate;
  1668. return self;},
  1669. args: ["aDate"],
  1670. source: ">= aDate\x0a\x09<return self >>= aDate>",
  1671. messageSends: [],
  1672. referencedClasses: []
  1673. }),
  1674. smalltalk.Date);
  1675. smalltalk.addMethod(
  1676. "_asDateString",
  1677. smalltalk.method({
  1678. selector: "asDateString",
  1679. category: 'converting',
  1680. fn: function (){
  1681. var self=this;
  1682. return self.toDateString();
  1683. return self;},
  1684. args: [],
  1685. source: "asDateString\x0a\x09<return self.toDateString()>",
  1686. messageSends: [],
  1687. referencedClasses: []
  1688. }),
  1689. smalltalk.Date);
  1690. smalltalk.addMethod(
  1691. "_asLocaleString",
  1692. smalltalk.method({
  1693. selector: "asLocaleString",
  1694. category: 'converting',
  1695. fn: function (){
  1696. var self=this;
  1697. return self.toLocaleString();
  1698. return self;},
  1699. args: [],
  1700. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  1701. messageSends: [],
  1702. referencedClasses: []
  1703. }),
  1704. smalltalk.Date);
  1705. smalltalk.addMethod(
  1706. "_asMilliseconds",
  1707. smalltalk.method({
  1708. selector: "asMilliseconds",
  1709. category: 'converting',
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.send(self, "_time", []);
  1713. return self;},
  1714. args: [],
  1715. source: "asMilliseconds\x0a\x09^self time",
  1716. messageSends: ["time"],
  1717. referencedClasses: []
  1718. }),
  1719. smalltalk.Date);
  1720. smalltalk.addMethod(
  1721. "_asNumber",
  1722. smalltalk.method({
  1723. selector: "asNumber",
  1724. category: 'converting',
  1725. fn: function (){
  1726. var self=this;
  1727. return smalltalk.send(self, "_asMilliseconds", []);
  1728. return self;},
  1729. args: [],
  1730. source: "asNumber\x0a\x09^self asMilliseconds",
  1731. messageSends: ["asMilliseconds"],
  1732. referencedClasses: []
  1733. }),
  1734. smalltalk.Date);
  1735. smalltalk.addMethod(
  1736. "_asString",
  1737. smalltalk.method({
  1738. selector: "asString",
  1739. category: 'converting',
  1740. fn: function (){
  1741. var self=this;
  1742. return self.toString();
  1743. return self;},
  1744. args: [],
  1745. source: "asString\x0a\x09<return self.toString()>",
  1746. messageSends: [],
  1747. referencedClasses: []
  1748. }),
  1749. smalltalk.Date);
  1750. smalltalk.addMethod(
  1751. "_asTimeString",
  1752. smalltalk.method({
  1753. selector: "asTimeString",
  1754. category: 'converting',
  1755. fn: function (){
  1756. var self=this;
  1757. return self.toTimeString();
  1758. return self;},
  1759. args: [],
  1760. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  1761. messageSends: [],
  1762. referencedClasses: []
  1763. }),
  1764. smalltalk.Date);
  1765. smalltalk.addMethod(
  1766. "_day",
  1767. smalltalk.method({
  1768. selector: "day",
  1769. category: 'accessing',
  1770. fn: function (){
  1771. var self=this;
  1772. return smalltalk.send(self, "_dayOfWeek", []);
  1773. return self;},
  1774. args: [],
  1775. source: "day\x0a\x09^self dayOfWeek",
  1776. messageSends: ["dayOfWeek"],
  1777. referencedClasses: []
  1778. }),
  1779. smalltalk.Date);
  1780. smalltalk.addMethod(
  1781. "_day_",
  1782. smalltalk.method({
  1783. selector: "day:",
  1784. category: 'accessing',
  1785. fn: function (aNumber){
  1786. var self=this;
  1787. smalltalk.send(self, "_dayOfWeek_", [aNumber]);
  1788. return self;},
  1789. args: ["aNumber"],
  1790. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  1791. messageSends: ["dayOfWeek:"],
  1792. referencedClasses: []
  1793. }),
  1794. smalltalk.Date);
  1795. smalltalk.addMethod(
  1796. "_dayOfMonth",
  1797. smalltalk.method({
  1798. selector: "dayOfMonth",
  1799. category: 'accessing',
  1800. fn: function (){
  1801. var self=this;
  1802. return self.getDate();
  1803. return self;},
  1804. args: [],
  1805. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  1806. messageSends: [],
  1807. referencedClasses: []
  1808. }),
  1809. smalltalk.Date);
  1810. smalltalk.addMethod(
  1811. "_dayOfMonth_",
  1812. smalltalk.method({
  1813. selector: "dayOfMonth:",
  1814. category: 'accessing',
  1815. fn: function (aNumber){
  1816. var self=this;
  1817. self.setDate(aNumber);
  1818. return self;},
  1819. args: ["aNumber"],
  1820. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  1821. messageSends: [],
  1822. referencedClasses: []
  1823. }),
  1824. smalltalk.Date);
  1825. smalltalk.addMethod(
  1826. "_dayOfWeek",
  1827. smalltalk.method({
  1828. selector: "dayOfWeek",
  1829. category: 'accessing',
  1830. fn: function (){
  1831. var self=this;
  1832. return self.getDay() + 1;
  1833. return self;},
  1834. args: [],
  1835. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  1836. messageSends: [],
  1837. referencedClasses: []
  1838. }),
  1839. smalltalk.Date);
  1840. smalltalk.addMethod(
  1841. "_dayOfWeek_",
  1842. smalltalk.method({
  1843. selector: "dayOfWeek:",
  1844. category: 'accessing',
  1845. fn: function (aNumber){
  1846. var self=this;
  1847. return self.setDay(aNumber - 1);
  1848. return self;},
  1849. args: ["aNumber"],
  1850. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  1851. messageSends: [],
  1852. referencedClasses: []
  1853. }),
  1854. smalltalk.Date);
  1855. smalltalk.addMethod(
  1856. "_hours",
  1857. smalltalk.method({
  1858. selector: "hours",
  1859. category: 'accessing',
  1860. fn: function (){
  1861. var self=this;
  1862. return self.getHours();
  1863. return self;},
  1864. args: [],
  1865. source: "hours\x0a\x09<return self.getHours()>",
  1866. messageSends: [],
  1867. referencedClasses: []
  1868. }),
  1869. smalltalk.Date);
  1870. smalltalk.addMethod(
  1871. "_hours_",
  1872. smalltalk.method({
  1873. selector: "hours:",
  1874. category: 'accessing',
  1875. fn: function (aNumber){
  1876. var self=this;
  1877. self.setHours(aNumber);
  1878. return self;},
  1879. args: ["aNumber"],
  1880. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  1881. messageSends: [],
  1882. referencedClasses: []
  1883. }),
  1884. smalltalk.Date);
  1885. smalltalk.addMethod(
  1886. "_milliseconds",
  1887. smalltalk.method({
  1888. selector: "milliseconds",
  1889. category: 'accessing',
  1890. fn: function (){
  1891. var self=this;
  1892. return self.getMilliseconds();
  1893. return self;},
  1894. args: [],
  1895. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  1896. messageSends: [],
  1897. referencedClasses: []
  1898. }),
  1899. smalltalk.Date);
  1900. smalltalk.addMethod(
  1901. "_milliseconds_",
  1902. smalltalk.method({
  1903. selector: "milliseconds:",
  1904. category: 'accessing',
  1905. fn: function (aNumber){
  1906. var self=this;
  1907. self.setMilliseconds(aNumber);
  1908. return self;},
  1909. args: ["aNumber"],
  1910. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  1911. messageSends: [],
  1912. referencedClasses: []
  1913. }),
  1914. smalltalk.Date);
  1915. smalltalk.addMethod(
  1916. "_minutes",
  1917. smalltalk.method({
  1918. selector: "minutes",
  1919. category: 'accessing',
  1920. fn: function (){
  1921. var self=this;
  1922. return self.getMinutes();
  1923. return self;},
  1924. args: [],
  1925. source: "minutes\x0a\x09<return self.getMinutes()>",
  1926. messageSends: [],
  1927. referencedClasses: []
  1928. }),
  1929. smalltalk.Date);
  1930. smalltalk.addMethod(
  1931. "_minutes_",
  1932. smalltalk.method({
  1933. selector: "minutes:",
  1934. category: 'accessing',
  1935. fn: function (aNumber){
  1936. var self=this;
  1937. self.setMinutes(aNumber);
  1938. return self;},
  1939. args: ["aNumber"],
  1940. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  1941. messageSends: [],
  1942. referencedClasses: []
  1943. }),
  1944. smalltalk.Date);
  1945. smalltalk.addMethod(
  1946. "_month",
  1947. smalltalk.method({
  1948. selector: "month",
  1949. category: 'accessing',
  1950. fn: function (){
  1951. var self=this;
  1952. return self.getMonth() + 1;
  1953. return self;},
  1954. args: [],
  1955. source: "month\x0a\x09<return self.getMonth() + 1>",
  1956. messageSends: [],
  1957. referencedClasses: []
  1958. }),
  1959. smalltalk.Date);
  1960. smalltalk.addMethod(
  1961. "_month_",
  1962. smalltalk.method({
  1963. selector: "month:",
  1964. category: 'accessing',
  1965. fn: function (aNumber){
  1966. var self=this;
  1967. self.setMonth(aNumber - 1);
  1968. return self;},
  1969. args: ["aNumber"],
  1970. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  1971. messageSends: [],
  1972. referencedClasses: []
  1973. }),
  1974. smalltalk.Date);
  1975. smalltalk.addMethod(
  1976. "_printString",
  1977. smalltalk.method({
  1978. selector: "printString",
  1979. category: 'printing',
  1980. fn: function (){
  1981. var self=this;
  1982. return smalltalk.send(self, "_asString", []);
  1983. return self;},
  1984. args: [],
  1985. source: "printString\x0a\x09^self asString",
  1986. messageSends: ["asString"],
  1987. referencedClasses: []
  1988. }),
  1989. smalltalk.Date);
  1990. smalltalk.addMethod(
  1991. "_seconds",
  1992. smalltalk.method({
  1993. selector: "seconds",
  1994. category: 'accessing',
  1995. fn: function (){
  1996. var self=this;
  1997. return self.getSeconds();
  1998. return self;},
  1999. args: [],
  2000. source: "seconds\x0a\x09<return self.getSeconds()>",
  2001. messageSends: [],
  2002. referencedClasses: []
  2003. }),
  2004. smalltalk.Date);
  2005. smalltalk.addMethod(
  2006. "_seconds_",
  2007. smalltalk.method({
  2008. selector: "seconds:",
  2009. category: 'accessing',
  2010. fn: function (aNumber){
  2011. var self=this;
  2012. self.setSeconds(aNumber);
  2013. return self;},
  2014. args: ["aNumber"],
  2015. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2016. messageSends: [],
  2017. referencedClasses: []
  2018. }),
  2019. smalltalk.Date);
  2020. smalltalk.addMethod(
  2021. "_time",
  2022. smalltalk.method({
  2023. selector: "time",
  2024. category: 'accessing',
  2025. fn: function (){
  2026. var self=this;
  2027. return self.getTime();
  2028. return self;},
  2029. args: [],
  2030. source: "time\x0a\x09<return self.getTime()>",
  2031. messageSends: [],
  2032. referencedClasses: []
  2033. }),
  2034. smalltalk.Date);
  2035. smalltalk.addMethod(
  2036. "_time_",
  2037. smalltalk.method({
  2038. selector: "time:",
  2039. category: 'accessing',
  2040. fn: function (aNumber){
  2041. var self=this;
  2042. self.setTime(aNumber);
  2043. return self;},
  2044. args: ["aNumber"],
  2045. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2046. messageSends: [],
  2047. referencedClasses: []
  2048. }),
  2049. smalltalk.Date);
  2050. smalltalk.addMethod(
  2051. "_year",
  2052. smalltalk.method({
  2053. selector: "year",
  2054. category: 'accessing',
  2055. fn: function (){
  2056. var self=this;
  2057. return self.getFullYear();
  2058. return self;},
  2059. args: [],
  2060. source: "year\x0a\x09<return self.getFullYear()>",
  2061. messageSends: [],
  2062. referencedClasses: []
  2063. }),
  2064. smalltalk.Date);
  2065. smalltalk.addMethod(
  2066. "_year_",
  2067. smalltalk.method({
  2068. selector: "year:",
  2069. category: 'accessing',
  2070. fn: function (aNumber){
  2071. var self=this;
  2072. self.setFullYear(aNumber);
  2073. return self;},
  2074. args: ["aNumber"],
  2075. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2076. messageSends: [],
  2077. referencedClasses: []
  2078. }),
  2079. smalltalk.Date);
  2080. smalltalk.addMethod(
  2081. "_fromMilliseconds_",
  2082. smalltalk.method({
  2083. selector: "fromMilliseconds:",
  2084. category: 'instance creation',
  2085. fn: function (aNumber){
  2086. var self=this;
  2087. return smalltalk.send(self, "_new_", [aNumber]);
  2088. return self;},
  2089. args: ["aNumber"],
  2090. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2091. messageSends: ["new:"],
  2092. referencedClasses: []
  2093. }),
  2094. smalltalk.Date.klass);
  2095. smalltalk.addMethod(
  2096. "_fromSeconds_",
  2097. smalltalk.method({
  2098. selector: "fromSeconds:",
  2099. category: 'instance creation',
  2100. fn: function (aNumber){
  2101. var self=this;
  2102. return smalltalk.send(self, "_fromMilliseconds_", [((($receiver = aNumber).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))]);
  2103. return self;},
  2104. args: ["aNumber"],
  2105. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2106. messageSends: ["fromMilliseconds:", "*"],
  2107. referencedClasses: []
  2108. }),
  2109. smalltalk.Date.klass);
  2110. smalltalk.addMethod(
  2111. "_fromString_",
  2112. smalltalk.method({
  2113. selector: "fromString:",
  2114. category: 'instance creation',
  2115. fn: function (aString){
  2116. var self=this;
  2117. return smalltalk.send(self, "_new_", [aString]);
  2118. return self;},
  2119. args: ["aString"],
  2120. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2121. messageSends: ["new:"],
  2122. referencedClasses: []
  2123. }),
  2124. smalltalk.Date.klass);
  2125. smalltalk.addMethod(
  2126. "_millisecondsToRun_",
  2127. smalltalk.method({
  2128. selector: "millisecondsToRun:",
  2129. category: 'instance creation',
  2130. fn: function (aBlock){
  2131. var self=this;
  2132. var t=nil;
  2133. (t=smalltalk.send((smalltalk.Date || Date), "_now", []));
  2134. smalltalk.send(aBlock, "_value", []);
  2135. return ((($receiver = smalltalk.send((smalltalk.Date || Date), "_now", [])).klass === smalltalk.Number) ? $receiver -t : smalltalk.send($receiver, "__minus", [t]));
  2136. return self;},
  2137. args: ["aBlock"],
  2138. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2139. messageSends: ["now", "value", "-"],
  2140. referencedClasses: ["Date"]
  2141. }),
  2142. smalltalk.Date.klass);
  2143. smalltalk.addMethod(
  2144. "_new_",
  2145. smalltalk.method({
  2146. selector: "new:",
  2147. category: 'instance creation',
  2148. fn: function (anObject){
  2149. var self=this;
  2150. return new Date(anObject);
  2151. return self;},
  2152. args: ["anObject"],
  2153. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2154. messageSends: [],
  2155. referencedClasses: []
  2156. }),
  2157. smalltalk.Date.klass);
  2158. smalltalk.addMethod(
  2159. "_now",
  2160. smalltalk.method({
  2161. selector: "now",
  2162. category: 'instance creation',
  2163. fn: function (){
  2164. var self=this;
  2165. return smalltalk.send(self, "_today", []);
  2166. return self;},
  2167. args: [],
  2168. source: "now\x0a\x09^self today",
  2169. messageSends: ["today"],
  2170. referencedClasses: []
  2171. }),
  2172. smalltalk.Date.klass);
  2173. smalltalk.addMethod(
  2174. "_today",
  2175. smalltalk.method({
  2176. selector: "today",
  2177. category: 'instance creation',
  2178. fn: function (){
  2179. var self=this;
  2180. return smalltalk.send(self, "_new", []);
  2181. return self;},
  2182. args: [],
  2183. source: "today\x0a\x09^self new",
  2184. messageSends: ["new"],
  2185. referencedClasses: []
  2186. }),
  2187. smalltalk.Date.klass);
  2188. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  2189. 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`."
  2190. smalltalk.addMethod(
  2191. "_at_",
  2192. smalltalk.method({
  2193. selector: "at:",
  2194. category: 'accessing',
  2195. fn: function (aSymbol){
  2196. var self=this;
  2197. var attr=nil;
  2198. (attr=smalltalk.send(aSymbol, "_asString", []));
  2199. return self['@jsObject'][attr];
  2200. return self;},
  2201. args: ["aSymbol"],
  2202. source: "at: aSymbol\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<return self['@jsObject'][attr]>",
  2203. messageSends: ["asString"],
  2204. referencedClasses: []
  2205. }),
  2206. smalltalk.JSObjectProxy);
  2207. smalltalk.addMethod(
  2208. "_at_put_",
  2209. smalltalk.method({
  2210. selector: "at:put:",
  2211. category: 'accessing',
  2212. fn: function (aSymbol, anObject){
  2213. var self=this;
  2214. var attr=nil;
  2215. (attr=smalltalk.send(aSymbol, "_asString", []));
  2216. self['@jsObject'][attr] = anObject;
  2217. return self;},
  2218. args: ["aSymbol", "anObject"],
  2219. source: "at: aSymbol put: anObject\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<self['@jsObject'][attr] = anObject>",
  2220. messageSends: ["asString"],
  2221. referencedClasses: []
  2222. }),
  2223. smalltalk.JSObjectProxy);
  2224. smalltalk.addMethod(
  2225. "_doesNotUnderstand_",
  2226. smalltalk.method({
  2227. selector: "doesNotUnderstand:",
  2228. category: 'proxy',
  2229. fn: function (aMessage){
  2230. var self=this;
  2231. var obj=nil;
  2232. var selector=nil;
  2233. var jsSelector=nil;
  2234. var arguments=nil;
  2235. (obj=smalltalk.send(self, "_jsObject", []));
  2236. (selector=smalltalk.send(aMessage, "_selector", []));
  2237. (jsSelector=smalltalk.send(selector, "_asJavaScriptSelector", []));
  2238. (arguments=smalltalk.send(aMessage, "_arguments", []));
  2239. if(obj[jsSelector] != undefined) {return smalltalk.send(obj, jsSelector, arguments)};
  2240. smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.JSObjectProxy.superclass || nil);
  2241. return self;},
  2242. args: ["aMessage"],
  2243. source: "doesNotUnderstand: aMessage\x0a\x09| obj selector jsSelector arguments |\x0a\x09obj := self jsObject.\x0a\x09selector := aMessage selector.\x0a\x09jsSelector := selector asJavaScriptSelector.\x0a\x09arguments := aMessage arguments.\x0a\x09<if(obj[jsSelector] != undefined) {return smalltalk.send(obj, jsSelector, arguments)}>.\x0a\x09super doesNotUnderstand: aMessage",
  2244. messageSends: ["jsObject", "selector", "asJavaScriptSelector", "arguments", "doesNotUnderstand:"],
  2245. referencedClasses: []
  2246. }),
  2247. smalltalk.JSObjectProxy);
  2248. smalltalk.addMethod(
  2249. "_inspectOn_",
  2250. smalltalk.method({
  2251. selector: "inspectOn:",
  2252. category: 'proxy',
  2253. fn: function (anInspector){
  2254. var self=this;
  2255. var variables=nil;
  2256. (variables=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  2257. smalltalk.send(variables, "_at_put_", ["#self", smalltalk.send(self, "_jsObject", [])]);
  2258. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  2259. for(var i in self['@jsObject']) {
  2260. variables._at_put_(i, self['@jsObject'][i]);
  2261. };
  2262. smalltalk.send(anInspector, "_setVariables_", [variables]);
  2263. return self;},
  2264. args: ["anInspector"],
  2265. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09<for(var i in self['@jsObject']) {\x0a\x09\x09variables._at_put_(i, self['@jsObject'][i]);\x0a\x09}>.\x0a\x09anInspector setVariables: variables",
  2266. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "setVariables:"],
  2267. referencedClasses: ["Dictionary"]
  2268. }),
  2269. smalltalk.JSObjectProxy);
  2270. smalltalk.addMethod(
  2271. "_jsObject",
  2272. smalltalk.method({
  2273. selector: "jsObject",
  2274. category: 'accessing',
  2275. fn: function (){
  2276. var self=this;
  2277. return self['@jsObject'];
  2278. return self;},
  2279. args: [],
  2280. source: "jsObject\x0a\x09^jsObject",
  2281. messageSends: [],
  2282. referencedClasses: []
  2283. }),
  2284. smalltalk.JSObjectProxy);
  2285. smalltalk.addMethod(
  2286. "_jsObject_",
  2287. smalltalk.method({
  2288. selector: "jsObject:",
  2289. category: 'accessing',
  2290. fn: function (aJSObject){
  2291. var self=this;
  2292. (self['@jsObject']=aJSObject);
  2293. return self;},
  2294. args: ["aJSObject"],
  2295. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  2296. messageSends: [],
  2297. referencedClasses: []
  2298. }),
  2299. smalltalk.JSObjectProxy);
  2300. smalltalk.addMethod(
  2301. "_printString",
  2302. smalltalk.method({
  2303. selector: "printString",
  2304. category: 'proxy',
  2305. fn: function (){
  2306. var self=this;
  2307. return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_toString", []);
  2308. return self;},
  2309. args: [],
  2310. source: "printString\x0a\x09^self jsObject toString",
  2311. messageSends: ["toString", "jsObject"],
  2312. referencedClasses: []
  2313. }),
  2314. smalltalk.JSObjectProxy);
  2315. smalltalk.addMethod(
  2316. "_on_",
  2317. smalltalk.method({
  2318. selector: "on:",
  2319. category: 'instance creation',
  2320. fn: function (aJSObject){
  2321. var self=this;
  2322. return (function($rec){smalltalk.send($rec, "_jsObject_", [aJSObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  2323. return self;},
  2324. args: ["aJSObject"],
  2325. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  2326. messageSends: ["jsObject:", "yourself", "new"],
  2327. referencedClasses: []
  2328. }),
  2329. smalltalk.JSObjectProxy.klass);
  2330. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  2331. 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]."
  2332. smalltalk.addMethod(
  2333. "_&",
  2334. smalltalk.method({
  2335. selector: "&",
  2336. category: 'converting',
  2337. fn: function (aNumber){
  2338. var self=this;
  2339. return self & aNumber;
  2340. return self;},
  2341. args: ["aNumber"],
  2342. source: "& aNumber\x0a\x09<return self & aNumber>",
  2343. messageSends: [],
  2344. referencedClasses: []
  2345. }),
  2346. smalltalk.Number);
  2347. smalltalk.addMethod(
  2348. "__star",
  2349. smalltalk.method({
  2350. selector: "*",
  2351. category: 'arithmetic',
  2352. fn: function (aNumber){
  2353. var self=this;
  2354. return self * aNumber;
  2355. return self;},
  2356. args: ["aNumber"],
  2357. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  2358. messageSends: [],
  2359. referencedClasses: []
  2360. }),
  2361. smalltalk.Number);
  2362. smalltalk.addMethod(
  2363. "__plus",
  2364. smalltalk.method({
  2365. selector: "+",
  2366. category: 'arithmetic',
  2367. fn: function (aNumber){
  2368. var self=this;
  2369. return self + aNumber;
  2370. return self;},
  2371. args: ["aNumber"],
  2372. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  2373. messageSends: [],
  2374. referencedClasses: []
  2375. }),
  2376. smalltalk.Number);
  2377. smalltalk.addMethod(
  2378. "__minus",
  2379. smalltalk.method({
  2380. selector: "-",
  2381. category: 'arithmetic',
  2382. fn: function (aNumber){
  2383. var self=this;
  2384. return self - aNumber;
  2385. return self;},
  2386. args: ["aNumber"],
  2387. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  2388. messageSends: [],
  2389. referencedClasses: []
  2390. }),
  2391. smalltalk.Number);
  2392. smalltalk.addMethod(
  2393. "__slash",
  2394. smalltalk.method({
  2395. selector: "/",
  2396. category: 'arithmetic',
  2397. fn: function (aNumber){
  2398. var self=this;
  2399. return self / aNumber;
  2400. return self;},
  2401. args: ["aNumber"],
  2402. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  2403. messageSends: [],
  2404. referencedClasses: []
  2405. }),
  2406. smalltalk.Number);
  2407. smalltalk.addMethod(
  2408. "__lt",
  2409. smalltalk.method({
  2410. selector: "<",
  2411. category: 'comparing',
  2412. fn: function (aNumber){
  2413. var self=this;
  2414. return self < aNumber;
  2415. return self;},
  2416. args: ["aNumber"],
  2417. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  2418. messageSends: [],
  2419. referencedClasses: []
  2420. }),
  2421. smalltalk.Number);
  2422. smalltalk.addMethod(
  2423. "__lt_eq",
  2424. smalltalk.method({
  2425. selector: "<=",
  2426. category: 'comparing',
  2427. fn: function (aNumber){
  2428. var self=this;
  2429. return self <= aNumber;
  2430. return self;},
  2431. args: ["aNumber"],
  2432. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  2433. messageSends: [],
  2434. referencedClasses: []
  2435. }),
  2436. smalltalk.Number);
  2437. smalltalk.addMethod(
  2438. "__eq",
  2439. smalltalk.method({
  2440. selector: "=",
  2441. category: 'comparing',
  2442. fn: function (aNumber){
  2443. var self=this;
  2444. var $early={};
  2445. try{((($receiver = smalltalk.send(aNumber, "_isNumber", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  2446. return Number(self) == aNumber;
  2447. return self;
  2448. } catch(e) {if(e===$early)return e[0]; throw e}},
  2449. args: ["aNumber"],
  2450. source: "= aNumber\x0a\x09aNumber isNumber ifFalse: [^false]. \x0a\x09<return Number(self) == aNumber>",
  2451. messageSends: ["ifFalse:", "isNumber"],
  2452. referencedClasses: []
  2453. }),
  2454. smalltalk.Number);
  2455. smalltalk.addMethod(
  2456. "__gt",
  2457. smalltalk.method({
  2458. selector: ">",
  2459. category: 'comparing',
  2460. fn: function (aNumber){
  2461. var self=this;
  2462. return self > aNumber;
  2463. return self;},
  2464. args: ["aNumber"],
  2465. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  2466. messageSends: [],
  2467. referencedClasses: []
  2468. }),
  2469. smalltalk.Number);
  2470. smalltalk.addMethod(
  2471. "__gt_eq",
  2472. smalltalk.method({
  2473. selector: ">=",
  2474. category: 'comparing',
  2475. fn: function (aNumber){
  2476. var self=this;
  2477. return self >= aNumber;
  2478. return self;},
  2479. args: ["aNumber"],
  2480. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  2481. messageSends: [],
  2482. referencedClasses: []
  2483. }),
  2484. smalltalk.Number);
  2485. smalltalk.addMethod(
  2486. "__at",
  2487. smalltalk.method({
  2488. selector: "@",
  2489. category: 'converting',
  2490. fn: function (aNumber){
  2491. var self=this;
  2492. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [self, aNumber]);
  2493. return self;},
  2494. args: ["aNumber"],
  2495. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  2496. messageSends: ["x:y:"],
  2497. referencedClasses: ["Point"]
  2498. }),
  2499. smalltalk.Number);
  2500. smalltalk.addMethod(
  2501. "_\x5c\x5c",
  2502. smalltalk.method({
  2503. selector: "\x5c\x5c",
  2504. category: 'arithmetic',
  2505. fn: function (aNumber){
  2506. var self=this;
  2507. return self % aNumber;
  2508. return self;},
  2509. args: ["aNumber"],
  2510. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  2511. messageSends: [],
  2512. referencedClasses: []
  2513. }),
  2514. smalltalk.Number);
  2515. smalltalk.addMethod(
  2516. "_asJSON",
  2517. smalltalk.method({
  2518. selector: "asJSON",
  2519. category: 'converting',
  2520. fn: function (){
  2521. var self=this;
  2522. return self;
  2523. return self;},
  2524. args: [],
  2525. source: "asJSON\x0a\x09^self",
  2526. messageSends: [],
  2527. referencedClasses: []
  2528. }),
  2529. smalltalk.Number);
  2530. smalltalk.addMethod(
  2531. "_asJavascript",
  2532. smalltalk.method({
  2533. selector: "asJavascript",
  2534. category: 'converting',
  2535. fn: function (){
  2536. var self=this;
  2537. return smalltalk.send(smalltalk.send("(", "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [")"]);
  2538. return self;},
  2539. args: [],
  2540. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  2541. messageSends: [",", "printString"],
  2542. referencedClasses: []
  2543. }),
  2544. smalltalk.Number);
  2545. smalltalk.addMethod(
  2546. "_asPoint",
  2547. smalltalk.method({
  2548. selector: "asPoint",
  2549. category: 'converting',
  2550. fn: function (){
  2551. var self=this;
  2552. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [self, self]);
  2553. return self;},
  2554. args: [],
  2555. source: "asPoint\x0a\x09^Point x: self y: self",
  2556. messageSends: ["x:y:"],
  2557. referencedClasses: ["Point"]
  2558. }),
  2559. smalltalk.Number);
  2560. smalltalk.addMethod(
  2561. "_asString",
  2562. smalltalk.method({
  2563. selector: "asString",
  2564. category: 'converting',
  2565. fn: function (){
  2566. var self=this;
  2567. return smalltalk.send(self, "_printString", []);
  2568. return self;},
  2569. args: [],
  2570. source: "asString\x0a\x09^self printString",
  2571. messageSends: ["printString"],
  2572. referencedClasses: []
  2573. }),
  2574. smalltalk.Number);
  2575. smalltalk.addMethod(
  2576. "_atRandom",
  2577. smalltalk.method({
  2578. selector: "atRandom",
  2579. category: 'converting',
  2580. fn: function (){
  2581. var self=this;
  2582. return ((($receiver = smalltalk.send(((($receiver = smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", [])).klass === smalltalk.Number) ? $receiver *self : smalltalk.send($receiver, "__star", [self])), "_truncated", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));
  2583. return self;},
  2584. args: [],
  2585. source: "atRandom\x0a ^(Random new next * self) truncated + 1",
  2586. messageSends: ["+", "truncated", "*", "next", "new"],
  2587. referencedClasses: ["Random"]
  2588. }),
  2589. smalltalk.Number);
  2590. smalltalk.addMethod(
  2591. "_clearInterval",
  2592. smalltalk.method({
  2593. selector: "clearInterval",
  2594. category: 'timeouts/intervals',
  2595. fn: function (){
  2596. var self=this;
  2597. clearInterval(Number(self));
  2598. return self;},
  2599. args: [],
  2600. source: "clearInterval\x0a\x09<clearInterval(Number(self))>",
  2601. messageSends: [],
  2602. referencedClasses: []
  2603. }),
  2604. smalltalk.Number);
  2605. smalltalk.addMethod(
  2606. "_clearTimeout",
  2607. smalltalk.method({
  2608. selector: "clearTimeout",
  2609. category: 'timeouts/intervals',
  2610. fn: function (){
  2611. var self=this;
  2612. clearTimeout(Number(self));
  2613. return self;},
  2614. args: [],
  2615. source: "clearTimeout\x0a\x09<clearTimeout(Number(self))>",
  2616. messageSends: [],
  2617. referencedClasses: []
  2618. }),
  2619. smalltalk.Number);
  2620. smalltalk.addMethod(
  2621. "_copy",
  2622. smalltalk.method({
  2623. selector: "copy",
  2624. category: 'copying',
  2625. fn: function (){
  2626. var self=this;
  2627. return self;
  2628. return self;},
  2629. args: [],
  2630. source: "copy\x0a\x09^self",
  2631. messageSends: [],
  2632. referencedClasses: []
  2633. }),
  2634. smalltalk.Number);
  2635. smalltalk.addMethod(
  2636. "_deepCopy",
  2637. smalltalk.method({
  2638. selector: "deepCopy",
  2639. category: 'copying',
  2640. fn: function (){
  2641. var self=this;
  2642. return smalltalk.send(self, "_copy", []);
  2643. return self;},
  2644. args: [],
  2645. source: "deepCopy\x0a\x09^self copy",
  2646. messageSends: ["copy"],
  2647. referencedClasses: []
  2648. }),
  2649. smalltalk.Number);
  2650. smalltalk.addMethod(
  2651. "_even",
  2652. smalltalk.method({
  2653. selector: "even",
  2654. category: 'testing',
  2655. fn: function (){
  2656. var self=this;
  2657. return smalltalk.send((0), "__eq", [smalltalk.send(self, "_\\\\", [(2)])]);
  2658. return self;},
  2659. args: [],
  2660. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  2661. messageSends: ["=", "\x5c\x5c\x5c\x5c"],
  2662. referencedClasses: []
  2663. }),
  2664. smalltalk.Number);
  2665. smalltalk.addMethod(
  2666. "_identityHash",
  2667. smalltalk.method({
  2668. selector: "identityHash",
  2669. category: 'accessing',
  2670. fn: function (){
  2671. var self=this;
  2672. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", ["n"]);
  2673. return self;},
  2674. args: [],
  2675. source: "identityHash\x0a\x09^self asString, 'n'",
  2676. messageSends: [",", "asString"],
  2677. referencedClasses: []
  2678. }),
  2679. smalltalk.Number);
  2680. smalltalk.addMethod(
  2681. "_isNumber",
  2682. smalltalk.method({
  2683. selector: "isNumber",
  2684. category: 'testing',
  2685. fn: function (){
  2686. var self=this;
  2687. return true;
  2688. return self;},
  2689. args: [],
  2690. source: "isNumber\x0a\x09^true",
  2691. messageSends: [],
  2692. referencedClasses: []
  2693. }),
  2694. smalltalk.Number);
  2695. smalltalk.addMethod(
  2696. "_isZero",
  2697. smalltalk.method({
  2698. selector: "isZero",
  2699. category: 'testing',
  2700. fn: function (){
  2701. var self=this;
  2702. return smalltalk.send(self, "__eq", [(0)]);
  2703. return self;},
  2704. args: [],
  2705. source: "isZero\x0a\x09^self = 0",
  2706. messageSends: ["="],
  2707. referencedClasses: []
  2708. }),
  2709. smalltalk.Number);
  2710. smalltalk.addMethod(
  2711. "_max_",
  2712. smalltalk.method({
  2713. selector: "max:",
  2714. category: 'arithmetic',
  2715. fn: function (aNumber){
  2716. var self=this;
  2717. return Math.max(self, aNumber);;
  2718. return self;},
  2719. args: ["aNumber"],
  2720. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  2721. messageSends: [],
  2722. referencedClasses: []
  2723. }),
  2724. smalltalk.Number);
  2725. smalltalk.addMethod(
  2726. "_min_",
  2727. smalltalk.method({
  2728. selector: "min:",
  2729. category: 'arithmetic',
  2730. fn: function (aNumber){
  2731. var self=this;
  2732. return Math.min(self, aNumber);;
  2733. return self;},
  2734. args: ["aNumber"],
  2735. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  2736. messageSends: [],
  2737. referencedClasses: []
  2738. }),
  2739. smalltalk.Number);
  2740. smalltalk.addMethod(
  2741. "_negated",
  2742. smalltalk.method({
  2743. selector: "negated",
  2744. category: 'arithmetic',
  2745. fn: function (){
  2746. var self=this;
  2747. return (0) - self;
  2748. return self;},
  2749. args: [],
  2750. source: "negated\x0a\x09^0 - self",
  2751. messageSends: ["-"],
  2752. referencedClasses: []
  2753. }),
  2754. smalltalk.Number);
  2755. smalltalk.addMethod(
  2756. "_negative",
  2757. smalltalk.method({
  2758. selector: "negative",
  2759. category: 'testing',
  2760. fn: function (){
  2761. var self=this;
  2762. return self < (0);
  2763. return self;},
  2764. args: [],
  2765. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  2766. messageSends: ["<"],
  2767. referencedClasses: []
  2768. }),
  2769. smalltalk.Number);
  2770. smalltalk.addMethod(
  2771. "_odd",
  2772. smalltalk.method({
  2773. selector: "odd",
  2774. category: 'testing',
  2775. fn: function (){
  2776. var self=this;
  2777. return smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  2778. return self;},
  2779. args: [],
  2780. source: "odd\x0a\x09^ self even not",
  2781. messageSends: ["not", "even"],
  2782. referencedClasses: []
  2783. }),
  2784. smalltalk.Number);
  2785. smalltalk.addMethod(
  2786. "_positive",
  2787. smalltalk.method({
  2788. selector: "positive",
  2789. category: 'testing',
  2790. fn: function (){
  2791. var self=this;
  2792. return self >= (0);
  2793. return self;},
  2794. args: [],
  2795. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  2796. messageSends: [">="],
  2797. referencedClasses: []
  2798. }),
  2799. smalltalk.Number);
  2800. smalltalk.addMethod(
  2801. "_printShowingDecimalPlaces_",
  2802. smalltalk.method({
  2803. selector: "printShowingDecimalPlaces:",
  2804. category: 'printing',
  2805. fn: function (placesDesired){
  2806. var self=this;
  2807. return self.toFixed(placesDesired);
  2808. return self;},
  2809. args: ["placesDesired"],
  2810. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  2811. messageSends: [],
  2812. referencedClasses: []
  2813. }),
  2814. smalltalk.Number);
  2815. smalltalk.addMethod(
  2816. "_printString",
  2817. smalltalk.method({
  2818. selector: "printString",
  2819. category: 'printing',
  2820. fn: function (){
  2821. var self=this;
  2822. return String(self);
  2823. return self;},
  2824. args: [],
  2825. source: "printString\x0a\x09<return String(self)>",
  2826. messageSends: [],
  2827. referencedClasses: []
  2828. }),
  2829. smalltalk.Number);
  2830. smalltalk.addMethod(
  2831. "_rounded",
  2832. smalltalk.method({
  2833. selector: "rounded",
  2834. category: 'converting',
  2835. fn: function (){
  2836. var self=this;
  2837. return Math.round(self);;
  2838. return self;},
  2839. args: [],
  2840. source: "rounded\x0a\x09<return Math.round(self);>",
  2841. messageSends: [],
  2842. referencedClasses: []
  2843. }),
  2844. smalltalk.Number);
  2845. smalltalk.addMethod(
  2846. "_sqrt",
  2847. smalltalk.method({
  2848. selector: "sqrt",
  2849. category: 'arithmetic',
  2850. fn: function (){
  2851. var self=this;
  2852. return Math.sqrt(self);
  2853. return self;},
  2854. args: [],
  2855. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  2856. messageSends: [],
  2857. referencedClasses: []
  2858. }),
  2859. smalltalk.Number);
  2860. smalltalk.addMethod(
  2861. "_squared",
  2862. smalltalk.method({
  2863. selector: "squared",
  2864. category: 'arithmetic',
  2865. fn: function (){
  2866. var self=this;
  2867. return self * self;
  2868. return self;},
  2869. args: [],
  2870. source: "squared\x0a\x09^self * self",
  2871. messageSends: ["*"],
  2872. referencedClasses: []
  2873. }),
  2874. smalltalk.Number);
  2875. smalltalk.addMethod(
  2876. "_timesRepeat_",
  2877. smalltalk.method({
  2878. selector: "timesRepeat:",
  2879. category: 'enumerating',
  2880. fn: function (aBlock){
  2881. var self=this;
  2882. var integer=nil;
  2883. var count=nil;
  2884. (integer=smalltalk.send(self, "_truncated", []));
  2885. (count=(1));
  2886. (function(){while(!(function(){return ((($receiver = count).klass === smalltalk.Number) ? $receiver >self : smalltalk.send($receiver, "__gt", [self]));})()) {(function(){smalltalk.send(aBlock, "_value", []);return (count=((($receiver = count).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  2887. return self;},
  2888. args: ["aBlock"],
  2889. source: "timesRepeat: aBlock\x0a\x09| integer count |\x0a\x09integer := self truncated.\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09 aBlock value.\x0a\x09 count := count + 1]",
  2890. messageSends: ["truncated", "whileFalse:", ">", "value", "+"],
  2891. referencedClasses: []
  2892. }),
  2893. smalltalk.Number);
  2894. smalltalk.addMethod(
  2895. "_to_",
  2896. smalltalk.method({
  2897. selector: "to:",
  2898. category: 'converting',
  2899. fn: function (aNumber){
  2900. var self=this;
  2901. var array=nil;
  2902. var first=nil;
  2903. var last=nil;
  2904. var count=nil;
  2905. (first=smalltalk.send(self, "_truncated", []));
  2906. (last=((($receiver = smalltalk.send(aNumber, "_truncated", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));
  2907. (count=(1));
  2908. (array=smalltalk.send((smalltalk.Array || Array), "_new", []));
  2909. smalltalk.send(((($receiver = last).klass === smalltalk.Number) ? $receiver -first : smalltalk.send($receiver, "__minus", [first])), "_timesRepeat_", [(function(){smalltalk.send(array, "_at_put_", [count, first]);(count=((($receiver = count).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (first=((($receiver = first).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  2910. return array;
  2911. return self;},
  2912. args: ["aNumber"],
  2913. 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",
  2914. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"],
  2915. referencedClasses: ["Array"]
  2916. }),
  2917. smalltalk.Number);
  2918. smalltalk.addMethod(
  2919. "_to_by_",
  2920. smalltalk.method({
  2921. selector: "to:by:",
  2922. category: 'converting',
  2923. fn: function (stop, step){
  2924. var self=this;
  2925. var array=nil;
  2926. var value=nil;
  2927. var pos=nil;
  2928. (value=self);
  2929. (array=smalltalk.send((smalltalk.Array || Array), "_new", []));
  2930. (pos=(1));
  2931. ((($receiver = smalltalk.send(step, "__eq", [(0)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})]));
  2932. ((($receiver = ((($receiver = step).klass === smalltalk.Number) ? $receiver <(0) : smalltalk.send($receiver, "__lt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})() : (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();}), (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})]));
  2933. return array;
  2934. return self;},
  2935. args: ["stop", "step"],
  2936. 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",
  2937. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="],
  2938. referencedClasses: ["Array"]
  2939. }),
  2940. smalltalk.Number);
  2941. smalltalk.addMethod(
  2942. "_to_by_do_",
  2943. smalltalk.method({
  2944. selector: "to:by:do:",
  2945. category: 'enumerating',
  2946. fn: function (stop, step, aBlock){
  2947. var self=this;
  2948. var value=nil;
  2949. (value=self);
  2950. ((($receiver = smalltalk.send(step, "__eq", [(0)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})]));
  2951. ((($receiver = ((($receiver = step).klass === smalltalk.Number) ? $receiver <(0) : smalltalk.send($receiver, "__lt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})() : (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();}), (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})]));
  2952. return self;},
  2953. args: ["stop", "step", "aBlock"],
  2954. 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]]",
  2955. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="],
  2956. referencedClasses: []
  2957. }),
  2958. smalltalk.Number);
  2959. smalltalk.addMethod(
  2960. "_to_do_",
  2961. smalltalk.method({
  2962. selector: "to:do:",
  2963. category: 'enumerating',
  2964. fn: function (stop, aBlock){
  2965. var self=this;
  2966. var nextValue=nil;
  2967. (nextValue=self);
  2968. (function(){while((function(){return ((($receiver = nextValue).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [nextValue]);return (nextValue=((($receiver = nextValue).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  2969. return self;},
  2970. args: ["stop", "aBlock"],
  2971. 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]",
  2972. messageSends: ["whileTrue:", "<=", "value:", "+"],
  2973. referencedClasses: []
  2974. }),
  2975. smalltalk.Number);
  2976. smalltalk.addMethod(
  2977. "_truncated",
  2978. smalltalk.method({
  2979. selector: "truncated",
  2980. category: 'converting',
  2981. fn: function (){
  2982. var self=this;
  2983. var result=nil;
  2984. ((($receiver = self >= (0)).klass === smalltalk.Boolean) ? ($receiver ? (function(){return result = Math.floor(self);;})() : (function(){return result = (Math.floor(self * (-1)) * (-1));;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return result = Math.floor(self);;}), (function(){return result = (Math.floor(self * (-1)) * (-1));;})]));
  2985. return result;
  2986. return self;},
  2987. args: [],
  2988. source: "truncated\x0a|result|\x0a\x0a self >= 0 \x0a ifTrue: [<result = Math.floor(self);>]\x0a ifFalse: [<result = (Math.floor(self * (-1)) * (-1));>].\x0a\x0a ^ result",
  2989. messageSends: ["ifTrue:ifFalse:", ">="],
  2990. referencedClasses: []
  2991. }),
  2992. smalltalk.Number);
  2993. smalltalk.addMethod(
  2994. "_|",
  2995. smalltalk.method({
  2996. selector: "|",
  2997. category: 'converting',
  2998. fn: function (aNumber){
  2999. var self=this;
  3000. return self | aNumber;
  3001. return self;},
  3002. args: ["aNumber"],
  3003. source: "| aNumber\x0a\x09<return self | aNumber>",
  3004. messageSends: [],
  3005. referencedClasses: []
  3006. }),
  3007. smalltalk.Number);
  3008. smalltalk.addMethod(
  3009. "_pi",
  3010. smalltalk.method({
  3011. selector: "pi",
  3012. category: 'instance creation',
  3013. fn: function (){
  3014. var self=this;
  3015. return Math.PI;
  3016. return self;},
  3017. args: [],
  3018. source: "pi\x0a\x09<return Math.PI>",
  3019. messageSends: [],
  3020. referencedClasses: []
  3021. }),
  3022. smalltalk.Number.klass);
  3023. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  3024. 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'"
  3025. smalltalk.addMethod(
  3026. "_classes",
  3027. smalltalk.method({
  3028. selector: "classes",
  3029. category: 'classes',
  3030. fn: function (){
  3031. var self=this;
  3032. return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", []), "_select_", [(function(c){return smalltalk.send(smalltalk.send(c, "_package", []), "__eq_eq", [self]);})]);
  3033. return self;},
  3034. args: [],
  3035. source: "classes\x0a\x09\x22We need to do a reverse scan.\x22\x0a\x09^Smalltalk current classes select: [:c | c package == self]",
  3036. messageSends: ["select:", "classes", "current", "==", "package"],
  3037. referencedClasses: ["Smalltalk"]
  3038. }),
  3039. smalltalk.Package);
  3040. smalltalk.addMethod(
  3041. "_commitPathJs",
  3042. smalltalk.method({
  3043. selector: "commitPathJs",
  3044. category: 'accessing',
  3045. fn: function (){
  3046. var self=this;
  3047. return (($receiver = self['@commitPathJs']) == nil || $receiver == undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);})() : $receiver;
  3048. return self;},
  3049. args: [],
  3050. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  3051. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  3052. referencedClasses: []
  3053. }),
  3054. smalltalk.Package);
  3055. smalltalk.addMethod(
  3056. "_commitPathJs_",
  3057. smalltalk.method({
  3058. selector: "commitPathJs:",
  3059. category: 'accessing',
  3060. fn: function (aString){
  3061. var self=this;
  3062. (self['@commitPathJs']=aString);
  3063. return self;},
  3064. args: ["aString"],
  3065. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  3066. messageSends: [],
  3067. referencedClasses: []
  3068. }),
  3069. smalltalk.Package);
  3070. smalltalk.addMethod(
  3071. "_commitPathSt",
  3072. smalltalk.method({
  3073. selector: "commitPathSt",
  3074. category: 'accessing',
  3075. fn: function (){
  3076. var self=this;
  3077. return (($receiver = self['@commitPathSt']) == nil || $receiver == undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);})() : $receiver;
  3078. return self;},
  3079. args: [],
  3080. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  3081. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  3082. referencedClasses: []
  3083. }),
  3084. smalltalk.Package);
  3085. smalltalk.addMethod(
  3086. "_commitPathSt_",
  3087. smalltalk.method({
  3088. selector: "commitPathSt:",
  3089. category: 'accessing',
  3090. fn: function (aString){
  3091. var self=this;
  3092. (self['@commitPathSt']=aString);
  3093. return self;},
  3094. args: ["aString"],
  3095. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  3096. messageSends: [],
  3097. referencedClasses: []
  3098. }),
  3099. smalltalk.Package);
  3100. smalltalk.addMethod(
  3101. "_dependencies",
  3102. smalltalk.method({
  3103. selector: "dependencies",
  3104. category: 'accessing',
  3105. fn: function (){
  3106. var self=this;
  3107. return smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", (function(){return [];})]);
  3108. return self;},
  3109. args: [],
  3110. source: "dependencies\x0a\x09^self propertyAt: 'dependencies' ifAbsent: [#()]",
  3111. messageSends: ["propertyAt:ifAbsent:"],
  3112. referencedClasses: []
  3113. }),
  3114. smalltalk.Package);
  3115. smalltalk.addMethod(
  3116. "_dependencies_",
  3117. smalltalk.method({
  3118. selector: "dependencies:",
  3119. category: 'accessing',
  3120. fn: function (anArray){
  3121. var self=this;
  3122. return smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  3123. return self;},
  3124. args: ["anArray"],
  3125. source: "dependencies: anArray\x0a\x09^self propertyAt: 'dependencies' put: anArray",
  3126. messageSends: ["propertyAt:put:"],
  3127. referencedClasses: []
  3128. }),
  3129. smalltalk.Package);
  3130. smalltalk.addMethod(
  3131. "_jsProperties",
  3132. smalltalk.method({
  3133. selector: "jsProperties",
  3134. category: 'private',
  3135. fn: function (){
  3136. var self=this;
  3137. return self.properties;
  3138. return self;},
  3139. args: [],
  3140. source: "jsProperties\x0a\x09<return self.properties>",
  3141. messageSends: [],
  3142. referencedClasses: []
  3143. }),
  3144. smalltalk.Package);
  3145. smalltalk.addMethod(
  3146. "_jsProperties_",
  3147. smalltalk.method({
  3148. selector: "jsProperties:",
  3149. category: 'private',
  3150. fn: function (aJSObject){
  3151. var self=this;
  3152. return self.properties = aJSObject;
  3153. return self;},
  3154. args: ["aJSObject"],
  3155. source: "jsProperties: aJSObject\x0a\x09<return self.properties = aJSObject>",
  3156. messageSends: [],
  3157. referencedClasses: []
  3158. }),
  3159. smalltalk.Package);
  3160. smalltalk.addMethod(
  3161. "_name",
  3162. smalltalk.method({
  3163. selector: "name",
  3164. category: 'accessing',
  3165. fn: function (){
  3166. var self=this;
  3167. return self.pkgName;
  3168. return self;},
  3169. args: [],
  3170. source: "name\x0a\x09<return self.pkgName>",
  3171. messageSends: [],
  3172. referencedClasses: []
  3173. }),
  3174. smalltalk.Package);
  3175. smalltalk.addMethod(
  3176. "_name_",
  3177. smalltalk.method({
  3178. selector: "name:",
  3179. category: 'accessing',
  3180. fn: function (aString){
  3181. var self=this;
  3182. self.pkgName = aString;
  3183. return self;},
  3184. args: ["aString"],
  3185. source: "name: aString\x0a\x09<self.pkgName = aString>",
  3186. messageSends: [],
  3187. referencedClasses: []
  3188. }),
  3189. smalltalk.Package);
  3190. smalltalk.addMethod(
  3191. "_printString",
  3192. smalltalk.method({
  3193. selector: "printString",
  3194. category: 'printing',
  3195. fn: function (){
  3196. var self=this;
  3197. return smalltalk.send(self, "_name", []);
  3198. return self;},
  3199. args: [],
  3200. source: "printString\x0a\x09^self name",
  3201. messageSends: ["name"],
  3202. referencedClasses: []
  3203. }),
  3204. smalltalk.Package);
  3205. smalltalk.addMethod(
  3206. "_properties",
  3207. smalltalk.method({
  3208. selector: "properties",
  3209. category: 'accessing',
  3210. fn: function (){
  3211. var self=this;
  3212. return smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  3213. return self;},
  3214. args: [],
  3215. source: "properties\x0a\x09^Smalltalk current readJSObject: (self basicAt: 'properties')",
  3216. messageSends: ["readJSObject:", "current", "basicAt:"],
  3217. referencedClasses: ["Smalltalk"]
  3218. }),
  3219. smalltalk.Package);
  3220. smalltalk.addMethod(
  3221. "_properties_",
  3222. smalltalk.method({
  3223. selector: "properties:",
  3224. category: 'accessing',
  3225. fn: function (aDict){
  3226. var self=this;
  3227. var object=nil;
  3228. object = {};;
  3229. smalltalk.send(aDict, "_keysAndValuesDo_", [(function(key, value){return object[key] = value;})]);
  3230. return self.properties = object;
  3231. return self;},
  3232. args: ["aDict"],
  3233. source: "properties: aDict\x0a\x09\x22We store it as a javascript object.\x22\x0a\x09\x0a\x09| object |\x0a\x09<object = {};>.\x0a\x09aDict keysAndValuesDo: [:key :value |\x0a\x09\x09<object[key] = value>.\x0a\x09].\x0a\x09<return self.properties = object>",
  3234. messageSends: ["keysAndValuesDo:"],
  3235. referencedClasses: []
  3236. }),
  3237. smalltalk.Package);
  3238. smalltalk.addMethod(
  3239. "_propertiesAsJSON",
  3240. smalltalk.method({
  3241. selector: "propertiesAsJSON",
  3242. category: 'private',
  3243. fn: function (){
  3244. var self=this;
  3245. return JSON.stringify(self.properties);
  3246. return self;},
  3247. args: [],
  3248. source: "propertiesAsJSON\x0a\x09<return JSON.stringify(self.properties)>",
  3249. messageSends: [],
  3250. referencedClasses: []
  3251. }),
  3252. smalltalk.Package);
  3253. smalltalk.addMethod(
  3254. "_propertyAt_",
  3255. smalltalk.method({
  3256. selector: "propertyAt:",
  3257. category: 'properties',
  3258. fn: function (key){
  3259. var self=this;
  3260. return self.properties[key];
  3261. return self;},
  3262. args: ["key"],
  3263. source: "propertyAt: key\x0a\x0a\x09<return self.properties[key]>",
  3264. messageSends: [],
  3265. referencedClasses: []
  3266. }),
  3267. smalltalk.Package);
  3268. smalltalk.addMethod(
  3269. "_propertyAt_ifAbsent_",
  3270. smalltalk.method({
  3271. selector: "propertyAt:ifAbsent:",
  3272. category: 'properties',
  3273. fn: function (key, block){
  3274. var self=this;
  3275. return (($receiver = smalltalk.send(self, "_propertyAt_", [key])) == nil || $receiver == undefined) ? (function(){return smalltalk.send(block, "_value", []);})() : $receiver;
  3276. return self;},
  3277. args: ["key", "block"],
  3278. source: "propertyAt: key ifAbsent: block\x0a\x0a\x09^(self propertyAt: key) ifNil: [block value]",
  3279. messageSends: ["ifNil:", "propertyAt:", "value"],
  3280. referencedClasses: []
  3281. }),
  3282. smalltalk.Package);
  3283. smalltalk.addMethod(
  3284. "_propertyAt_put_",
  3285. smalltalk.method({
  3286. selector: "propertyAt:put:",
  3287. category: 'properties',
  3288. fn: function (key, value){
  3289. var self=this;
  3290. return self.properties[key] = value;
  3291. return self;},
  3292. args: ["key", "value"],
  3293. source: "propertyAt: key put: value\x0a\x0a\x09<return self.properties[key] = value>",
  3294. messageSends: [],
  3295. referencedClasses: []
  3296. }),
  3297. smalltalk.Package);
  3298. smalltalk.addMethod(
  3299. "_sortedClasses",
  3300. smalltalk.method({
  3301. selector: "sortedClasses",
  3302. category: 'classes',
  3303. fn: function (){
  3304. var self=this;
  3305. return smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  3306. return self;},
  3307. args: [],
  3308. 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",
  3309. messageSends: ["sortedClasses:", "class", "classes"],
  3310. referencedClasses: []
  3311. }),
  3312. smalltalk.Package);
  3313. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  3314. smalltalk.addMethod(
  3315. "_commitToLocalStorage_",
  3316. smalltalk.method({
  3317. selector: "commitToLocalStorage:",
  3318. category: 'loading-storing',
  3319. fn: function (aPackageName){
  3320. var self=this;
  3321. var key=nil;
  3322. var sourceCode=nil;
  3323. (key=smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]));
  3324. (sourceCode=smalltalk.send(smalltalk.send((smalltalk.Exporter || Exporter), "_new", []), "_exportPackage_", [aPackageName]));
  3325. localStorage[key] = escape(sourceCode);
  3326. return self;},
  3327. args: ["aPackageName"],
  3328. source: "commitToLocalStorage: aPackageName\x0a\x09| key sourceCode |\x0a\x09key := 'smalltalk.packages.' , aPackageName.\x0a\x09sourceCode := Exporter new exportPackage: aPackageName.\x0a\x09<localStorage[key] = escape(sourceCode)>",
  3329. messageSends: [",", "exportPackage:", "new"],
  3330. referencedClasses: ["Exporter"]
  3331. }),
  3332. smalltalk.Package.klass);
  3333. smalltalk.addMethod(
  3334. "_defaultCommitPathJs",
  3335. smalltalk.method({
  3336. selector: "defaultCommitPathJs",
  3337. category: 'commit paths',
  3338. fn: function (){
  3339. var self=this;
  3340. return (($receiver = self['@defaultCommitPathJs']) == nil || $receiver == undefined) ? (function(){return (self['@defaultCommitPathJs']="js");})() : $receiver;
  3341. return self;},
  3342. args: [],
  3343. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  3344. messageSends: ["ifNil:"],
  3345. referencedClasses: []
  3346. }),
  3347. smalltalk.Package.klass);
  3348. smalltalk.addMethod(
  3349. "_defaultCommitPathJs_",
  3350. smalltalk.method({
  3351. selector: "defaultCommitPathJs:",
  3352. category: 'commit paths',
  3353. fn: function (aString){
  3354. var self=this;
  3355. (self['@defaultCommitPathJs']=aString);
  3356. return self;},
  3357. args: ["aString"],
  3358. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  3359. messageSends: [],
  3360. referencedClasses: []
  3361. }),
  3362. smalltalk.Package.klass);
  3363. smalltalk.addMethod(
  3364. "_defaultCommitPathSt",
  3365. smalltalk.method({
  3366. selector: "defaultCommitPathSt",
  3367. category: 'commit paths',
  3368. fn: function (){
  3369. var self=this;
  3370. return (($receiver = self['@defaultCommitPathSt']) == nil || $receiver == undefined) ? (function(){return (self['@defaultCommitPathSt']="st");})() : $receiver;
  3371. return self;},
  3372. args: [],
  3373. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  3374. messageSends: ["ifNil:"],
  3375. referencedClasses: []
  3376. }),
  3377. smalltalk.Package.klass);
  3378. smalltalk.addMethod(
  3379. "_defaultCommitPathSt_",
  3380. smalltalk.method({
  3381. selector: "defaultCommitPathSt:",
  3382. category: 'commit paths',
  3383. fn: function (aString){
  3384. var self=this;
  3385. (self['@defaultCommitPathSt']=aString);
  3386. return self;},
  3387. args: ["aString"],
  3388. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  3389. messageSends: [],
  3390. referencedClasses: []
  3391. }),
  3392. smalltalk.Package.klass);
  3393. smalltalk.addMethod(
  3394. "_fetch_",
  3395. smalltalk.method({
  3396. selector: "fetch:",
  3397. category: 'loading-storing',
  3398. fn: function (aPackageName){
  3399. var self=this;
  3400. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  3401. return self;},
  3402. args: ["aPackageName"],
  3403. source: "fetch: aPackageName\x0a\x09self fetch: aPackageName prefix: self defaultCommitPathJs, '/'",
  3404. messageSends: ["fetch:prefix:", ",", "defaultCommitPathJs"],
  3405. referencedClasses: []
  3406. }),
  3407. smalltalk.Package.klass);
  3408. smalltalk.addMethod(
  3409. "_fetch_prefix_",
  3410. smalltalk.method({
  3411. selector: "fetch:prefix:",
  3412. category: 'loading-storing',
  3413. fn: function (aPackageName, aPrefix){
  3414. var self=this;
  3415. smalltalk.send((typeof jQuery == 'undefined' ? nil : jQuery), "_getScript_onSuccess_", [smalltalk.send(smalltalk.send(aPrefix, "__comma", [aPackageName]), "__comma", [".js"]), (function(){return smalltalk.send((smalltalk.Package || Package), "_init_", [aPackageName]);})]);
  3416. return self;},
  3417. args: ["aPackageName", "aPrefix"],
  3418. source: "fetch: aPackageName prefix: aPrefix\x0a\x09jQuery getScript: (aPrefix , aPackageName , '.js') onSuccess: [ Package init: aPackageName ]",
  3419. messageSends: ["getScript:onSuccess:", ",", "init:"],
  3420. referencedClasses: ["Package"]
  3421. }),
  3422. smalltalk.Package.klass);
  3423. smalltalk.addMethod(
  3424. "_init_",
  3425. smalltalk.method({
  3426. selector: "init:",
  3427. category: 'loading-storing',
  3428. fn: function (aPackageName){
  3429. var self=this;
  3430. (function($rec){smalltalk.send($rec, "_do_", [(function(each){return smalltalk.init(each);})]);return smalltalk.send($rec, "_do_", [(function(each){return smalltalk.send(each, "_initialize", []);})]);})(smalltalk.send(smalltalk.send((typeof smalltalk == 'undefined' ? nil : smalltalk), "_classes", []), "_select_", [(function(each){return each.pkg.pkgName == aPackageName;})]));
  3431. return self;},
  3432. args: ["aPackageName"],
  3433. source: "init: aPackageName\x0a\x09(smalltalk classes select: [ :each | <each.pkg.pkgName == aPackageName> ])\x0a\x09\x09do: [ :each | <smalltalk.init(each)> ];\x0a\x09\x09do: [ :each | each initialize ]",
  3434. messageSends: ["do:", "initialize", "select:", "classes"],
  3435. referencedClasses: []
  3436. }),
  3437. smalltalk.Package.klass);
  3438. smalltalk.addMethod(
  3439. "_named_",
  3440. smalltalk.method({
  3441. selector: "named:",
  3442. category: 'not yet classified',
  3443. fn: function (aPackageName){
  3444. var self=this;
  3445. return smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_packageAt_", [aPackageName]);
  3446. return self;},
  3447. args: ["aPackageName"],
  3448. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  3449. messageSends: ["packageAt:", "current"],
  3450. referencedClasses: ["Smalltalk"]
  3451. }),
  3452. smalltalk.Package.klass);
  3453. smalltalk.addMethod(
  3454. "_named_ifAbsent_",
  3455. smalltalk.method({
  3456. selector: "named:ifAbsent:",
  3457. category: 'not yet classified',
  3458. fn: function (aPackageName, aBlock){
  3459. var self=this;
  3460. return smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  3461. return self;},
  3462. args: ["aPackageName", "aBlock"],
  3463. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  3464. messageSends: ["packageAt:ifAbsent:", "current"],
  3465. referencedClasses: ["Smalltalk"]
  3466. }),
  3467. smalltalk.Package.klass);
  3468. smalltalk.addMethod(
  3469. "_resetCommitPaths",
  3470. smalltalk.method({
  3471. selector: "resetCommitPaths",
  3472. category: 'commit paths',
  3473. fn: function (){
  3474. var self=this;
  3475. (self['@defaultCommitPathJs']=nil);
  3476. (self['@defaultCommitPathSt']=nil);
  3477. return self;},
  3478. args: [],
  3479. source: "resetCommitPaths\x0a defaultCommitPathJs := nil.\x0a defaultCommitPathSt := nil.",
  3480. messageSends: [],
  3481. referencedClasses: []
  3482. }),
  3483. smalltalk.Package.klass);
  3484. smalltalk.addMethod(
  3485. "_sortedClasses_",
  3486. smalltalk.method({
  3487. selector: "sortedClasses:",
  3488. category: 'sorting',
  3489. fn: function (classes){
  3490. var self=this;
  3491. var children=nil;
  3492. var others=nil;
  3493. var nodes=nil;
  3494. var expandedClasses=nil;
  3495. (children=[]);
  3496. (others=[]);
  3497. smalltalk.send(classes, "_do_", [(function(each){return ((($receiver = smalltalk.send(classes, "_includes_", [smalltalk.send(each, "_superclass", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(children, "_add_", [each]);})() : (function(){return smalltalk.send(others, "_add_", [each]);})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return smalltalk.send(children, "_add_", [each]);}), (function(){return smalltalk.send(others, "_add_", [each]);})]));})]);
  3498. (nodes=smalltalk.send(children, "_collect_", [(function(each){return smalltalk.send((smalltalk.ClassSorterNode || ClassSorterNode), "_on_classes_level_", [each, others, (0)]);})]));
  3499. (nodes=smalltalk.send(nodes, "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(smalltalk.send(a, "_theClass", []), "_name", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", [])]));})]));
  3500. (expandedClasses=smalltalk.send((smalltalk.Array || Array), "_new", []));
  3501. smalltalk.send(nodes, "_do_", [(function(aNode){return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);})]);
  3502. return expandedClasses;
  3503. return self;},
  3504. args: ["classes"],
  3505. 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",
  3506. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  3507. referencedClasses: ["ClassSorterNode", "Array"]
  3508. }),
  3509. smalltalk.Package.klass);
  3510. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  3511. 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."
  3512. smalltalk.addMethod(
  3513. "__star",
  3514. smalltalk.method({
  3515. selector: "*",
  3516. category: 'arithmetic',
  3517. fn: function (aPoint){
  3518. var self=this;
  3519. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3520. return self;},
  3521. args: ["aPoint"],
  3522. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  3523. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  3524. referencedClasses: ["Point"]
  3525. }),
  3526. smalltalk.Point);
  3527. smalltalk.addMethod(
  3528. "__plus",
  3529. smalltalk.method({
  3530. selector: "+",
  3531. category: 'arithmetic',
  3532. fn: function (aPoint){
  3533. var self=this;
  3534. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3535. return self;},
  3536. args: ["aPoint"],
  3537. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  3538. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  3539. referencedClasses: ["Point"]
  3540. }),
  3541. smalltalk.Point);
  3542. smalltalk.addMethod(
  3543. "__minus",
  3544. smalltalk.method({
  3545. selector: "-",
  3546. category: 'arithmetic',
  3547. fn: function (aPoint){
  3548. var self=this;
  3549. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3550. return self;},
  3551. args: ["aPoint"],
  3552. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  3553. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  3554. referencedClasses: ["Point"]
  3555. }),
  3556. smalltalk.Point);
  3557. smalltalk.addMethod(
  3558. "__slash",
  3559. smalltalk.method({
  3560. selector: "/",
  3561. category: 'arithmetic',
  3562. fn: function (aPoint){
  3563. var self=this;
  3564. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver /smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver /smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3565. return self;},
  3566. args: ["aPoint"],
  3567. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  3568. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  3569. referencedClasses: ["Point"]
  3570. }),
  3571. smalltalk.Point);
  3572. smalltalk.addMethod(
  3573. "__eq",
  3574. smalltalk.method({
  3575. selector: "=",
  3576. category: 'arithmetic',
  3577. fn: function (aPoint){
  3578. var self=this;
  3579. return smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_class", []), "__eq", [smalltalk.send(self, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_x", []), "__eq", [smalltalk.send(self, "_x", [])]), "_&", [smalltalk.send(smalltalk.send(aPoint, "_y", []), "__eq", [smalltalk.send(self, "_y", [])])]);})]);
  3580. return self;},
  3581. args: ["aPoint"],
  3582. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  3583. messageSends: ["and:", "=", "class", "&", "x", "y"],
  3584. referencedClasses: []
  3585. }),
  3586. smalltalk.Point);
  3587. smalltalk.addMethod(
  3588. "_asPoint",
  3589. smalltalk.method({
  3590. selector: "asPoint",
  3591. category: 'converting',
  3592. fn: function (){
  3593. var self=this;
  3594. return self;
  3595. return self;},
  3596. args: [],
  3597. source: "asPoint\x0a\x09^self",
  3598. messageSends: [],
  3599. referencedClasses: []
  3600. }),
  3601. smalltalk.Point);
  3602. smalltalk.addMethod(
  3603. "_printString",
  3604. smalltalk.method({
  3605. selector: "printString",
  3606. category: 'printing',
  3607. fn: function (){
  3608. var self=this;
  3609. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@x'], "_printString", []), "__comma", ["@"])]);((($receiver = smalltalk.send(smalltalk.send(self['@y'], "_notNil", []), "_and_", [(function(){return smalltalk.send(self['@y'], "_negative", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(stream, "_space", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(stream, "_space", []);})]));return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self['@y'], "_printString", [])]);})]);
  3610. return self;},
  3611. args: [],
  3612. 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]",
  3613. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "ifTrue:", "and:", "notNil", "negative", "space"],
  3614. referencedClasses: ["String"]
  3615. }),
  3616. smalltalk.Point);
  3617. smalltalk.addMethod(
  3618. "_translateBy_",
  3619. smalltalk.method({
  3620. selector: "translateBy:",
  3621. category: 'transforming',
  3622. fn: function (delta){
  3623. var self=this;
  3624. return smalltalk.send(((($receiver = smalltalk.send(delta, "_x", [])).klass === smalltalk.Number) ? $receiver +self['@x'] : smalltalk.send($receiver, "__plus", [self['@x']])), "__at", [((($receiver = smalltalk.send(delta, "_y", [])).klass === smalltalk.Number) ? $receiver +self['@y'] : smalltalk.send($receiver, "__plus", [self['@y']]))]);
  3625. return self;},
  3626. args: ["delta"],
  3627. source: "translateBy: delta \x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  3628. messageSends: ["@", "+", "x", "y"],
  3629. referencedClasses: []
  3630. }),
  3631. smalltalk.Point);
  3632. smalltalk.addMethod(
  3633. "_x",
  3634. smalltalk.method({
  3635. selector: "x",
  3636. category: 'accessing',
  3637. fn: function (){
  3638. var self=this;
  3639. return self['@x'];
  3640. return self;},
  3641. args: [],
  3642. source: "x\x0a\x09^x",
  3643. messageSends: [],
  3644. referencedClasses: []
  3645. }),
  3646. smalltalk.Point);
  3647. smalltalk.addMethod(
  3648. "_x_",
  3649. smalltalk.method({
  3650. selector: "x:",
  3651. category: 'accessing',
  3652. fn: function (aNumber){
  3653. var self=this;
  3654. (self['@x']=aNumber);
  3655. return self;},
  3656. args: ["aNumber"],
  3657. source: "x: aNumber\x0a\x09x := aNumber",
  3658. messageSends: [],
  3659. referencedClasses: []
  3660. }),
  3661. smalltalk.Point);
  3662. smalltalk.addMethod(
  3663. "_y",
  3664. smalltalk.method({
  3665. selector: "y",
  3666. category: 'accessing',
  3667. fn: function (){
  3668. var self=this;
  3669. return self['@y'];
  3670. return self;},
  3671. args: [],
  3672. source: "y\x0a\x09^y",
  3673. messageSends: [],
  3674. referencedClasses: []
  3675. }),
  3676. smalltalk.Point);
  3677. smalltalk.addMethod(
  3678. "_y_",
  3679. smalltalk.method({
  3680. selector: "y:",
  3681. category: 'accessing',
  3682. fn: function (aNumber){
  3683. var self=this;
  3684. (self['@y']=aNumber);
  3685. return self;},
  3686. args: ["aNumber"],
  3687. source: "y: aNumber\x0a\x09y := aNumber",
  3688. messageSends: [],
  3689. referencedClasses: []
  3690. }),
  3691. smalltalk.Point);
  3692. smalltalk.addMethod(
  3693. "_x_y_",
  3694. smalltalk.method({
  3695. selector: "x:y:",
  3696. category: 'instance creation',
  3697. fn: function (aNumber, anotherNumber){
  3698. var self=this;
  3699. return (function($rec){smalltalk.send($rec, "_x_", [aNumber]);smalltalk.send($rec, "_y_", [anotherNumber]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  3700. return self;},
  3701. args: ["aNumber", "anotherNumber"],
  3702. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  3703. messageSends: ["x:", "y:", "yourself", "new"],
  3704. referencedClasses: []
  3705. }),
  3706. smalltalk.Point.klass);
  3707. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  3708. 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'`."
  3709. smalltalk.addMethod(
  3710. "_next",
  3711. smalltalk.method({
  3712. selector: "next",
  3713. category: 'accessing',
  3714. fn: function (){
  3715. var self=this;
  3716. return Math.random();
  3717. return self;},
  3718. args: [],
  3719. source: "next\x0a\x09<return Math.random()>",
  3720. messageSends: [],
  3721. referencedClasses: []
  3722. }),
  3723. smalltalk.Random);
  3724. smalltalk.addMethod(
  3725. "_next_",
  3726. smalltalk.method({
  3727. selector: "next:",
  3728. category: 'accessing',
  3729. fn: function (anInteger){
  3730. var self=this;
  3731. return smalltalk.send(smalltalk.send((1), "_to_", [anInteger]), "_collect_", [(function(each){return smalltalk.send(self, "_next", []);})]);
  3732. return self;},
  3733. args: ["anInteger"],
  3734. source: "next: anInteger\x0a ^(1 to: anInteger) collect: [:each | self next]",
  3735. messageSends: ["collect:", "to:", "next"],
  3736. referencedClasses: []
  3737. }),
  3738. smalltalk.Random);
  3739. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  3740. 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"
  3741. smalltalk.addMethod(
  3742. "_at_",
  3743. smalltalk.method({
  3744. selector: "at:",
  3745. category: 'accessing',
  3746. fn: function (aString){
  3747. var self=this;
  3748. return self[aString];
  3749. return self;},
  3750. args: ["aString"],
  3751. source: "at: aString\x0a\x09<return self[aString]>",
  3752. messageSends: [],
  3753. referencedClasses: []
  3754. }),
  3755. smalltalk.Smalltalk);
  3756. smalltalk.addMethod(
  3757. "_basicParse_",
  3758. smalltalk.method({
  3759. selector: "basicParse:",
  3760. category: 'accessing',
  3761. fn: function (aString){
  3762. var self=this;
  3763. return smalltalk.parser.parse(aString);
  3764. return self;},
  3765. args: ["aString"],
  3766. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  3767. messageSends: [],
  3768. referencedClasses: []
  3769. }),
  3770. smalltalk.Smalltalk);
  3771. smalltalk.addMethod(
  3772. "_classes",
  3773. smalltalk.method({
  3774. selector: "classes",
  3775. category: 'accessing',
  3776. fn: function (){
  3777. var self=this;
  3778. return self.classes();
  3779. return self;},
  3780. args: [],
  3781. source: "classes\x0a\x09<return self.classes()>",
  3782. messageSends: [],
  3783. referencedClasses: []
  3784. }),
  3785. smalltalk.Smalltalk);
  3786. smalltalk.addMethod(
  3787. "_createPackage_",
  3788. smalltalk.method({
  3789. selector: "createPackage:",
  3790. category: 'private',
  3791. fn: function (packageName){
  3792. var self=this;
  3793. return smalltalk.addPackage(packageName, nil);
  3794. return self;},
  3795. args: ["packageName"],
  3796. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x0a <return smalltalk.addPackage(packageName, nil)>",
  3797. messageSends: [],
  3798. referencedClasses: []
  3799. }),
  3800. smalltalk.Smalltalk);
  3801. smalltalk.addMethod(
  3802. "_createPackage_properties_",
  3803. smalltalk.method({
  3804. selector: "createPackage:properties:",
  3805. category: 'private',
  3806. fn: function (packageName, aDict){
  3807. var self=this;
  3808. var object=nil;
  3809. object = {};;
  3810. smalltalk.send(aDict, "_keysAndValuesDo_", [(function(key, value){return object[key] = value;})]);
  3811. return smalltalk.addPackage(packageName, object);
  3812. return self;},
  3813. args: ["packageName", "aDict"],
  3814. source: "createPackage: packageName properties: aDict\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x0a\x09| object |\x0a\x09<object = {};>.\x0a\x09aDict keysAndValuesDo: [:key :value |\x0a\x09\x09<object[key] = value>.\x0a\x09].\x0a <return smalltalk.addPackage(packageName, object)>",
  3815. messageSends: ["keysAndValuesDo:"],
  3816. referencedClasses: []
  3817. }),
  3818. smalltalk.Smalltalk);
  3819. smalltalk.addMethod(
  3820. "_deletePackage_",
  3821. smalltalk.method({
  3822. selector: "deletePackage:",
  3823. category: 'private',
  3824. fn: function (packageName){
  3825. var self=this;
  3826. delete smalltalk.packages[packageName];
  3827. return self;},
  3828. args: ["packageName"],
  3829. 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]>",
  3830. messageSends: [],
  3831. referencedClasses: []
  3832. }),
  3833. smalltalk.Smalltalk);
  3834. smalltalk.addMethod(
  3835. "_packageAt_",
  3836. smalltalk.method({
  3837. selector: "packageAt:",
  3838. category: 'packages',
  3839. fn: function (packageName){
  3840. var self=this;
  3841. return self.packages[packageName];
  3842. return self;},
  3843. args: ["packageName"],
  3844. source: "packageAt: packageName\x0a <return self.packages[packageName]>",
  3845. messageSends: [],
  3846. referencedClasses: []
  3847. }),
  3848. smalltalk.Smalltalk);
  3849. smalltalk.addMethod(
  3850. "_packageAt_ifAbsent_",
  3851. smalltalk.method({
  3852. selector: "packageAt:ifAbsent:",
  3853. category: 'packages',
  3854. fn: function (packageName, aBlock){
  3855. var self=this;
  3856. return smalltalk.send(smalltalk.send(self, "_packageAt_", [packageName]), "_ifNil_", [aBlock]);
  3857. return self;},
  3858. args: ["packageName", "aBlock"],
  3859. source: "packageAt: packageName ifAbsent: aBlock\x0a ^(self packageAt: packageName) ifNil: aBlock",
  3860. messageSends: ["ifNil:", "packageAt:"],
  3861. referencedClasses: []
  3862. }),
  3863. smalltalk.Smalltalk);
  3864. smalltalk.addMethod(
  3865. "_packages",
  3866. smalltalk.method({
  3867. selector: "packages",
  3868. category: 'packages',
  3869. fn: function (){
  3870. var self=this;
  3871. return self.packages.all();
  3872. return self;},
  3873. args: [],
  3874. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  3875. messageSends: [],
  3876. referencedClasses: []
  3877. }),
  3878. smalltalk.Smalltalk);
  3879. smalltalk.addMethod(
  3880. "_parse_",
  3881. smalltalk.method({
  3882. selector: "parse:",
  3883. category: 'accessing',
  3884. fn: function (aString){
  3885. var self=this;
  3886. var result=nil;
  3887. smalltalk.send(self, "_try_catch_", [(function(){return (result=smalltalk.send(self, "_basicParse_", [aString]));}), (function(ex){return smalltalk.send(smalltalk.send(self, "_parseError_parsing_", [ex, aString]), "_signal", []);})]);
  3888. return result;
  3889. return self;},
  3890. args: ["aString"],
  3891. source: "parse: aString\x0a\x09| result | \x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  3892. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  3893. referencedClasses: []
  3894. }),
  3895. smalltalk.Smalltalk);
  3896. smalltalk.addMethod(
  3897. "_parseError_parsing_",
  3898. smalltalk.method({
  3899. selector: "parseError:parsing:",
  3900. category: 'accessing',
  3901. fn: function (anException, aString){
  3902. var self=this;
  3903. var row=nil;
  3904. var col=nil;
  3905. var message=nil;
  3906. var lines=nil;
  3907. var badLine=nil;
  3908. var code=nil;
  3909. row = anException.line;
  3910. col = anException.column;
  3911. message = anException.message;;
  3912. (lines=smalltalk.send(aString, "_lines", []));
  3913. (badLine=smalltalk.send(lines, "_at_", [row]));
  3914. (badLine=smalltalk.send(smalltalk.send(smalltalk.send(badLine, "_copyFrom_to_", [(1), ((($receiver = col).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]))]), "__comma", [" ===>"]), "__comma", [smalltalk.send(badLine, "_copyFrom_to_", [col, smalltalk.send(badLine, "_size", [])])]));
  3915. smalltalk.send(lines, "_at_put_", [row, badLine]);
  3916. (code=smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(s){return smalltalk.send(lines, "_withIndexDo_", [(function(l, i){return smalltalk.send(s, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(i, "_asString", []), "__comma", [": "]), "__comma", [l]), "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])])]);})]);})]));
  3917. return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_messageText_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("Parse error on line ", "__comma", [row]), "__comma", [" column "]), "__comma", [col]), "__comma", [" : "]), "__comma", [message]), "__comma", [" Below is code with line numbers and ===> marker inserted:"]), "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])]), "__comma", [code])]);
  3918. return self;},
  3919. args: ["anException", "aString"],
  3920. source: "parseError: anException parsing: aString\x0a\x09| row col message lines badLine code |\x0a\x09<row = anException.line;\x0a\x09col = anException.column;\x0a\x09message = anException.message;>.\x0a\x09lines := aString lines.\x0a\x09badLine := lines at: row.\x0a\x09badLine := (badLine copyFrom: 1 to: col - 1), ' ===>', (badLine copyFrom: col to: badLine size).\x0a\x09lines at: row put: badLine.\x0a\x09code := String streamContents: [:s |\x0a lines withIndexDo: [:l :i |\x0a s nextPutAll: i asString, ': ', l, String lf]].\x0a\x09^ Error new messageText: ('Parse error on line ' , row , ' column ' , col , ' : ' , message , ' Below is code with line numbers and ===> marker inserted:' , String lf, code)",
  3921. messageSends: ["lines", "at:", ",", "copyFrom:to:", "-", "size", "at:put:", "streamContents:", "withIndexDo:", "nextPutAll:", "asString", "lf", "messageText:", "new"],
  3922. referencedClasses: ["String", "Error"]
  3923. }),
  3924. smalltalk.Smalltalk);
  3925. smalltalk.addMethod(
  3926. "_readJSObject_",
  3927. smalltalk.method({
  3928. selector: "readJSObject:",
  3929. category: 'accessing',
  3930. fn: function (anObject){
  3931. var self=this;
  3932. return self.readJSObject(anObject);
  3933. return self;},
  3934. args: ["anObject"],
  3935. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  3936. messageSends: [],
  3937. referencedClasses: []
  3938. }),
  3939. smalltalk.Smalltalk);
  3940. smalltalk.addMethod(
  3941. "_removeClass_",
  3942. smalltalk.method({
  3943. selector: "removeClass:",
  3944. category: 'classes',
  3945. fn: function (aClass){
  3946. var self=this;
  3947. ((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);})]));
  3948. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);})]);
  3949. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);})]);
  3950. smalltalk.send(self, "_basicDelete_", [smalltalk.send(aClass, "_name", [])]);
  3951. return self;},
  3952. args: ["aClass"],
  3953. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09aClass removeCompiledMethod: each].\x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09aClass class removeCompiledMethod: each].\x0a\x09self basicDelete: aClass name",
  3954. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "do:", "values", "methodDictionary", "removeCompiledMethod:", "class", "basicDelete:", "name"],
  3955. referencedClasses: []
  3956. }),
  3957. smalltalk.Smalltalk);
  3958. smalltalk.addMethod(
  3959. "_removePackage_",
  3960. smalltalk.method({
  3961. selector: "removePackage:",
  3962. category: 'packages',
  3963. fn: function (packageName){
  3964. var self=this;
  3965. var pkg=nil;
  3966. (pkg=smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, (function(){return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);})]));
  3967. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [(function(each){return smalltalk.send(self, "_removeClass_", [each]);})]);
  3968. smalltalk.send(self, "_deletePackage_", [packageName]);
  3969. return self;},
  3970. args: ["packageName"],
  3971. 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",
  3972. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
  3973. referencedClasses: []
  3974. }),
  3975. smalltalk.Smalltalk);
  3976. smalltalk.addMethod(
  3977. "_renamePackage_to_",
  3978. smalltalk.method({
  3979. selector: "renamePackage:to:",
  3980. category: 'packages',
  3981. fn: function (packageName, newName){
  3982. var self=this;
  3983. var pkg=nil;
  3984. (pkg=smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, (function(){return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);})]));
  3985. (($receiver = smalltalk.send(self, "_packageAt_", [newName])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);})() : nil;
  3986. smalltalk.packages[newName] = smalltalk.packages[packageName];
  3987. smalltalk.send(pkg, "_name_", [newName]);
  3988. smalltalk.send(self, "_deletePackage_", [packageName]);
  3989. return self;},
  3990. args: ["packageName", "newName"],
  3991. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09<smalltalk.packages[newName] = smalltalk.packages[packageName]>.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  3992. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "deletePackage:"],
  3993. referencedClasses: []
  3994. }),
  3995. smalltalk.Smalltalk);
  3996. smalltalk.addMethod(
  3997. "_reservedWords",
  3998. smalltalk.method({
  3999. selector: "reservedWords",
  4000. category: 'accessing',
  4001. fn: function (){
  4002. var self=this;
  4003. return self.reservedWords;
  4004. return self;},
  4005. args: [],
  4006. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  4007. messageSends: [],
  4008. referencedClasses: []
  4009. }),
  4010. smalltalk.Smalltalk);
  4011. smalltalk.addMethod(
  4012. "_send_to_arguments_",
  4013. smalltalk.method({
  4014. selector: "send:to:arguments:",
  4015. category: 'accessing',
  4016. fn: function (aSelector, anObject, aCollection){
  4017. var self=this;
  4018. var selector=nil;
  4019. (selector=smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []));
  4020. self.send(anObject, selector, aCollection);
  4021. return self;},
  4022. args: ["aSelector", "anObject", "aCollection"],
  4023. source: "send: aSelector to: anObject arguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSelector asString asSelector.\x0a\x09<self.send(anObject, selector, aCollection)>",
  4024. messageSends: ["asSelector", "asString"],
  4025. referencedClasses: []
  4026. }),
  4027. smalltalk.Smalltalk);
  4028. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  4029. smalltalk.addMethod(
  4030. "_current",
  4031. smalltalk.method({
  4032. selector: "current",
  4033. category: 'accessing',
  4034. fn: function (){
  4035. var self=this;
  4036. return smalltalk;
  4037. return self;},
  4038. args: [],
  4039. source: "current\x0a\x09<return smalltalk>",
  4040. messageSends: [],
  4041. referencedClasses: []
  4042. }),
  4043. smalltalk.Smalltalk.klass);
  4044. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  4045. 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."
  4046. smalltalk.addMethod(
  4047. "_asJSON",
  4048. smalltalk.method({
  4049. selector: "asJSON",
  4050. category: 'converting',
  4051. fn: function (){
  4052. var self=this;
  4053. return (typeof null == 'undefined' ? nil : null);
  4054. return self;},
  4055. args: [],
  4056. source: "asJSON\x0a\x09^null",
  4057. messageSends: [],
  4058. referencedClasses: []
  4059. }),
  4060. smalltalk.UndefinedObject);
  4061. smalltalk.addMethod(
  4062. "_deepCopy",
  4063. smalltalk.method({
  4064. selector: "deepCopy",
  4065. category: 'copying',
  4066. fn: function (){
  4067. var self=this;
  4068. return self;
  4069. return self;},
  4070. args: [],
  4071. source: "deepCopy\x0a\x09^self",
  4072. messageSends: [],
  4073. referencedClasses: []
  4074. }),
  4075. smalltalk.UndefinedObject);
  4076. smalltalk.addMethod(
  4077. "_ifNil_",
  4078. smalltalk.method({
  4079. selector: "ifNil:",
  4080. category: 'testing',
  4081. fn: function (aBlock){
  4082. var self=this;
  4083. return smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, (function(){return nil;})]);
  4084. return self;},
  4085. args: ["aBlock"],
  4086. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  4087. messageSends: ["ifNil:ifNotNil:"],
  4088. referencedClasses: []
  4089. }),
  4090. smalltalk.UndefinedObject);
  4091. smalltalk.addMethod(
  4092. "_ifNil_ifNotNil_",
  4093. smalltalk.method({
  4094. selector: "ifNil:ifNotNil:",
  4095. category: 'testing',
  4096. fn: function (aBlock, anotherBlock){
  4097. var self=this;
  4098. return smalltalk.send(aBlock, "_value", []);
  4099. return self;},
  4100. args: ["aBlock", "anotherBlock"],
  4101. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  4102. messageSends: ["value"],
  4103. referencedClasses: []
  4104. }),
  4105. smalltalk.UndefinedObject);
  4106. smalltalk.addMethod(
  4107. "_ifNotNil_",
  4108. smalltalk.method({
  4109. selector: "ifNotNil:",
  4110. category: 'testing',
  4111. fn: function (aBlock){
  4112. var self=this;
  4113. return self;
  4114. return self;},
  4115. args: ["aBlock"],
  4116. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  4117. messageSends: [],
  4118. referencedClasses: []
  4119. }),
  4120. smalltalk.UndefinedObject);
  4121. smalltalk.addMethod(
  4122. "_ifNotNil_ifNil_",
  4123. smalltalk.method({
  4124. selector: "ifNotNil:ifNil:",
  4125. category: 'testing',
  4126. fn: function (aBlock, anotherBlock){
  4127. var self=this;
  4128. return smalltalk.send(anotherBlock, "_value", []);
  4129. return self;},
  4130. args: ["aBlock", "anotherBlock"],
  4131. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  4132. messageSends: ["value"],
  4133. referencedClasses: []
  4134. }),
  4135. smalltalk.UndefinedObject);
  4136. smalltalk.addMethod(
  4137. "_isNil",
  4138. smalltalk.method({
  4139. selector: "isNil",
  4140. category: 'testing',
  4141. fn: function (){
  4142. var self=this;
  4143. return true;
  4144. return self;},
  4145. args: [],
  4146. source: "isNil\x0a\x09^true",
  4147. messageSends: [],
  4148. referencedClasses: []
  4149. }),
  4150. smalltalk.UndefinedObject);
  4151. smalltalk.addMethod(
  4152. "_notNil",
  4153. smalltalk.method({
  4154. selector: "notNil",
  4155. category: 'testing',
  4156. fn: function (){
  4157. var self=this;
  4158. return false;
  4159. return self;},
  4160. args: [],
  4161. source: "notNil\x0a\x09^false",
  4162. messageSends: [],
  4163. referencedClasses: []
  4164. }),
  4165. smalltalk.UndefinedObject);
  4166. smalltalk.addMethod(
  4167. "_printString",
  4168. smalltalk.method({
  4169. selector: "printString",
  4170. category: 'printing',
  4171. fn: function (){
  4172. var self=this;
  4173. return "nil";
  4174. return self;},
  4175. args: [],
  4176. source: "printString\x0a ^'nil'",
  4177. messageSends: [],
  4178. referencedClasses: []
  4179. }),
  4180. smalltalk.UndefinedObject);
  4181. smalltalk.addMethod(
  4182. "_shallowCopy",
  4183. smalltalk.method({
  4184. selector: "shallowCopy",
  4185. category: 'copying',
  4186. fn: function (){
  4187. var self=this;
  4188. return self;
  4189. return self;},
  4190. args: [],
  4191. source: "shallowCopy\x0a\x09^self",
  4192. messageSends: [],
  4193. referencedClasses: []
  4194. }),
  4195. smalltalk.UndefinedObject);
  4196. smalltalk.addMethod(
  4197. "_subclass_instanceVariableNames_",
  4198. smalltalk.method({
  4199. selector: "subclass:instanceVariableNames:",
  4200. category: 'class creation',
  4201. fn: function (aString, anotherString){
  4202. var self=this;
  4203. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  4204. return self;},
  4205. args: ["aString", "anotherString"],
  4206. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4207. messageSends: ["subclass:instanceVariableNames:package:"],
  4208. referencedClasses: []
  4209. }),
  4210. smalltalk.UndefinedObject);
  4211. smalltalk.addMethod(
  4212. "_subclass_instanceVariableNames_category_",
  4213. smalltalk.method({
  4214. selector: "subclass:instanceVariableNames:category:",
  4215. category: 'class creation',
  4216. fn: function (aString, aString2, aString3){
  4217. var self=this;
  4218. smalltalk.send(self, "_deprecatedAPI", []);
  4219. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  4220. return self;},
  4221. args: ["aString", "aString2", "aString3"],
  4222. 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",
  4223. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4224. referencedClasses: []
  4225. }),
  4226. smalltalk.UndefinedObject);
  4227. smalltalk.addMethod(
  4228. "_subclass_instanceVariableNames_package_",
  4229. smalltalk.method({
  4230. selector: "subclass:instanceVariableNames:package:",
  4231. category: 'class creation',
  4232. fn: function (aString, aString2, aString3){
  4233. var self=this;
  4234. return smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
  4235. return self;},
  4236. args: ["aString", "aString2", "aString3"],
  4237. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString instanceVariableNames: aString2 package: aString3",
  4238. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new"],
  4239. referencedClasses: ["ClassBuilder"]
  4240. }),
  4241. smalltalk.UndefinedObject);
  4242. smalltalk.addMethod(
  4243. "_new",
  4244. smalltalk.method({
  4245. selector: "new",
  4246. category: 'instance creation',
  4247. fn: function (){
  4248. var self=this;
  4249. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  4250. return self;},
  4251. args: [],
  4252. source: "new\x0a\x09 self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4253. messageSends: ["error:"],
  4254. referencedClasses: []
  4255. }),
  4256. smalltalk.UndefinedObject.klass);
  4257. smalltalk.addPackage('Kernel-Classes', {});
  4258. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  4259. 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."
  4260. smalltalk.addMethod(
  4261. "_addCompiledMethod_",
  4262. smalltalk.method({
  4263. selector: "addCompiledMethod:",
  4264. category: 'compiling',
  4265. fn: function (aMethod){
  4266. var self=this;
  4267. smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
  4268. return self;},
  4269. args: ["aMethod"],
  4270. source: "addCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>",
  4271. messageSends: [],
  4272. referencedClasses: []
  4273. }),
  4274. smalltalk.Behavior);
  4275. smalltalk.addMethod(
  4276. "_allInstanceVariableNames",
  4277. smalltalk.method({
  4278. selector: "allInstanceVariableNames",
  4279. category: 'accessing',
  4280. fn: function (){
  4281. var self=this;
  4282. var result=nil;
  4283. (result=smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_copy", []));
  4284. (($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(result, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allInstanceVariableNames", [])]);})() : nil;
  4285. return result;
  4286. return self;},
  4287. args: [],
  4288. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09 result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  4289. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
  4290. referencedClasses: []
  4291. }),
  4292. smalltalk.Behavior);
  4293. smalltalk.addMethod(
  4294. "_allSubclasses",
  4295. smalltalk.method({
  4296. selector: "allSubclasses",
  4297. category: 'accessing',
  4298. fn: function (){
  4299. var self=this;
  4300. var result=nil;
  4301. (result=smalltalk.send(self, "_subclasses", []));
  4302. smalltalk.send(smalltalk.send(self, "_subclasses", []), "_do_", [(function(each){return smalltalk.send(result, "_addAll_", [smalltalk.send(each, "_allSubclasses", [])]);})]);
  4303. return result;
  4304. return self;},
  4305. args: [],
  4306. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09 result addAll: each allSubclasses].\x0a\x09^result",
  4307. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  4308. referencedClasses: []
  4309. }),
  4310. smalltalk.Behavior);
  4311. smalltalk.addMethod(
  4312. "_basicNew",
  4313. smalltalk.method({
  4314. selector: "basicNew",
  4315. category: 'instance creation',
  4316. fn: function (){
  4317. var self=this;
  4318. return new self.fn();
  4319. return self;},
  4320. args: [],
  4321. source: "basicNew\x0a\x09<return new self.fn()>",
  4322. messageSends: [],
  4323. referencedClasses: []
  4324. }),
  4325. smalltalk.Behavior);
  4326. smalltalk.addMethod(
  4327. "_canUnderstand_",
  4328. smalltalk.method({
  4329. selector: "canUnderstand:",
  4330. category: 'testing',
  4331. fn: function (aSelector){
  4332. var self=this;
  4333. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_keys", []), "_includes_", [smalltalk.send(aSelector, "_asString", [])]), "_or_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_superclass", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_superclass", []), "_canUnderstand_", [aSelector]);})]);})]);
  4334. return self;},
  4335. args: ["aSelector"],
  4336. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  4337. messageSends: ["or:", "includes:", "keys", "methodDictionary", "asString", "and:", "notNil", "superclass", "canUnderstand:"],
  4338. referencedClasses: []
  4339. }),
  4340. smalltalk.Behavior);
  4341. smalltalk.addMethod(
  4342. "_comment",
  4343. smalltalk.method({
  4344. selector: "comment",
  4345. category: 'accessing',
  4346. fn: function (){
  4347. var self=this;
  4348. return (($receiver = smalltalk.send(self, "_basicAt_", ["comment"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  4349. return self;},
  4350. args: [],
  4351. source: "comment\x0a ^(self basicAt: 'comment') ifNil: ['']",
  4352. messageSends: ["ifNil:", "basicAt:"],
  4353. referencedClasses: []
  4354. }),
  4355. smalltalk.Behavior);
  4356. smalltalk.addMethod(
  4357. "_comment_",
  4358. smalltalk.method({
  4359. selector: "comment:",
  4360. category: 'accessing',
  4361. fn: function (aString){
  4362. var self=this;
  4363. smalltalk.send(self, "_basicAt_put_", ["comment", aString]);
  4364. return self;},
  4365. args: ["aString"],
  4366. source: "comment: aString\x0a self basicAt: 'comment' put: aString",
  4367. messageSends: ["basicAt:put:"],
  4368. referencedClasses: []
  4369. }),
  4370. smalltalk.Behavior);
  4371. smalltalk.addMethod(
  4372. "_commentStamp",
  4373. smalltalk.method({
  4374. selector: "commentStamp",
  4375. category: 'accessing',
  4376. fn: function (){
  4377. var self=this;
  4378. return (function($rec){smalltalk.send($rec, "_class_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCommentReader || ClassCommentReader), "_new", []));
  4379. return self;},
  4380. args: [],
  4381. source: "commentStamp\x0a ^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  4382. messageSends: ["class:", "yourself", "new"],
  4383. referencedClasses: ["ClassCommentReader"]
  4384. }),
  4385. smalltalk.Behavior);
  4386. smalltalk.addMethod(
  4387. "_commentStamp_prior_",
  4388. smalltalk.method({
  4389. selector: "commentStamp:prior:",
  4390. category: 'accessing',
  4391. fn: function (aStamp, prior){
  4392. var self=this;
  4393. return smalltalk.send(self, "_commentStamp", []);
  4394. return self;},
  4395. args: ["aStamp", "prior"],
  4396. source: "commentStamp: aStamp prior: prior\x0a ^self commentStamp",
  4397. messageSends: ["commentStamp"],
  4398. referencedClasses: []
  4399. }),
  4400. smalltalk.Behavior);
  4401. smalltalk.addMethod(
  4402. "_compile_",
  4403. smalltalk.method({
  4404. selector: "compile:",
  4405. category: 'compiling',
  4406. fn: function (aString){
  4407. var self=this;
  4408. smalltalk.send(self, "_compile_category_", [aString, ""]);
  4409. return self;},
  4410. args: ["aString"],
  4411. source: "compile: aString\x0a\x09self compile: aString category: ''",
  4412. messageSends: ["compile:category:"],
  4413. referencedClasses: []
  4414. }),
  4415. smalltalk.Behavior);
  4416. smalltalk.addMethod(
  4417. "_compile_category_",
  4418. smalltalk.method({
  4419. selector: "compile:category:",
  4420. category: 'compiling',
  4421. fn: function (aString, anotherString){
  4422. var self=this;
  4423. (function($rec){smalltalk.send($rec, "_install_forClass_category_", [aString, self, anotherString]);return smalltalk.send($rec, "_setupClass_", [self]);})(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []));
  4424. return self;},
  4425. args: ["aString", "anotherString"],
  4426. source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString forClass: self category: anotherString;\x0a\x09\x09setupClass: self",
  4427. messageSends: ["install:forClass:category:", "setupClass:", "new"],
  4428. referencedClasses: ["Compiler"]
  4429. }),
  4430. smalltalk.Behavior);
  4431. smalltalk.addMethod(
  4432. "_inheritsFrom_",
  4433. smalltalk.method({
  4434. selector: "inheritsFrom:",
  4435. category: 'testing',
  4436. fn: function (aClass){
  4437. var self=this;
  4438. return smalltalk.send(smalltalk.send(aClass, "_allSubclasses", []), "_includes_", [self]);
  4439. return self;},
  4440. args: ["aClass"],
  4441. source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
  4442. messageSends: ["includes:", "allSubclasses"],
  4443. referencedClasses: []
  4444. }),
  4445. smalltalk.Behavior);
  4446. smalltalk.addMethod(
  4447. "_instanceVariableNames",
  4448. smalltalk.method({
  4449. selector: "instanceVariableNames",
  4450. category: 'accessing',
  4451. fn: function (){
  4452. var self=this;
  4453. return self.iVarNames;
  4454. return self;},
  4455. args: [],
  4456. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  4457. messageSends: [],
  4458. referencedClasses: []
  4459. }),
  4460. smalltalk.Behavior);
  4461. smalltalk.addMethod(
  4462. "_methodAt_",
  4463. smalltalk.method({
  4464. selector: "methodAt:",
  4465. category: 'accessing',
  4466. fn: function (aString){
  4467. var self=this;
  4468. return smalltalk.methods(self)[aString];
  4469. return self;},
  4470. args: ["aString"],
  4471. source: "methodAt: aString\x0a\x09<return smalltalk.methods(self)[aString]>",
  4472. messageSends: [],
  4473. referencedClasses: []
  4474. }),
  4475. smalltalk.Behavior);
  4476. smalltalk.addMethod(
  4477. "_methodDictionary",
  4478. smalltalk.method({
  4479. selector: "methodDictionary",
  4480. category: 'accessing',
  4481. fn: function (){
  4482. var self=this;
  4483. var dict = smalltalk.HashedCollection._new();
  4484. var methods = self.fn.prototype.methods;
  4485. for(var i in methods) {
  4486. if(methods[i].selector) {
  4487. dict._at_put_(methods[i].selector, methods[i]);
  4488. }
  4489. };
  4490. return dict;
  4491. return self;},
  4492. args: [],
  4493. source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.fn.prototype.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>",
  4494. messageSends: [],
  4495. referencedClasses: []
  4496. }),
  4497. smalltalk.Behavior);
  4498. smalltalk.addMethod(
  4499. "_methodsFor_",
  4500. smalltalk.method({
  4501. selector: "methodsFor:",
  4502. category: 'accessing',
  4503. fn: function (aString){
  4504. var self=this;
  4505. return (function($rec){smalltalk.send($rec, "_class_category_", [self, aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCategoryReader || ClassCategoryReader), "_new", []));
  4506. return self;},
  4507. args: ["aString"],
  4508. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09 class: self category: aString;\x0a\x09 yourself",
  4509. messageSends: ["class:category:", "yourself", "new"],
  4510. referencedClasses: ["ClassCategoryReader"]
  4511. }),
  4512. smalltalk.Behavior);
  4513. smalltalk.addMethod(
  4514. "_methodsFor_stamp_",
  4515. smalltalk.method({
  4516. selector: "methodsFor:stamp:",
  4517. category: 'accessing',
  4518. fn: function (aString, aStamp){
  4519. var self=this;
  4520. return smalltalk.send(self, "_methodsFor_", [aString]);
  4521. return self;},
  4522. args: ["aString", "aStamp"],
  4523. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  4524. messageSends: ["methodsFor:"],
  4525. referencedClasses: []
  4526. }),
  4527. smalltalk.Behavior);
  4528. smalltalk.addMethod(
  4529. "_name",
  4530. smalltalk.method({
  4531. selector: "name",
  4532. category: 'accessing',
  4533. fn: function (){
  4534. var self=this;
  4535. return self.className || nil;
  4536. return self;},
  4537. args: [],
  4538. source: "name\x0a\x09<return self.className || nil>",
  4539. messageSends: [],
  4540. referencedClasses: []
  4541. }),
  4542. smalltalk.Behavior);
  4543. smalltalk.addMethod(
  4544. "_new",
  4545. smalltalk.method({
  4546. selector: "new",
  4547. category: 'instance creation',
  4548. fn: function (){
  4549. var self=this;
  4550. return smalltalk.send(smalltalk.send(self, "_basicNew", []), "_initialize", []);
  4551. return self;},
  4552. args: [],
  4553. source: "new\x0a\x09^self basicNew initialize",
  4554. messageSends: ["initialize", "basicNew"],
  4555. referencedClasses: []
  4556. }),
  4557. smalltalk.Behavior);
  4558. smalltalk.addMethod(
  4559. "_protocols",
  4560. smalltalk.method({
  4561. selector: "protocols",
  4562. category: 'accessing',
  4563. fn: function (){
  4564. var self=this;
  4565. var protocols=nil;
  4566. (protocols=smalltalk.send((smalltalk.Array || Array), "_new", []));
  4567. smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_do_", [(function(each){return ((($receiver = smalltalk.send(protocols, "_includes_", [smalltalk.send(each, "_category", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(protocols, "_add_", [smalltalk.send(each, "_category", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(protocols, "_add_", [smalltalk.send(each, "_category", [])]);})]));})]);
  4568. return smalltalk.send(protocols, "_sort", []);
  4569. return self;},
  4570. args: [],
  4571. source: "protocols\x0a | protocols |\x0a protocols := Array new.\x0a self methodDictionary do: [:each |\x0a\x09 (protocols includes: each category) ifFalse: [\x0a\x09\x09protocols add: each category]].\x0a ^protocols sort",
  4572. messageSends: ["new", "do:", "methodDictionary", "ifFalse:", "includes:", "category", "add:", "sort"],
  4573. referencedClasses: ["Array"]
  4574. }),
  4575. smalltalk.Behavior);
  4576. smalltalk.addMethod(
  4577. "_protocolsDo_",
  4578. smalltalk.method({
  4579. selector: "protocolsDo:",
  4580. category: 'accessing',
  4581. fn: function (aBlock){
  4582. var self=this;
  4583. var methodsByCategory=nil;
  4584. (methodsByCategory=smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_new", []));
  4585. smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_values", []), "_do_", [(function(m){return smalltalk.send(smalltalk.send(methodsByCategory, "_at_ifAbsentPut_", [smalltalk.send(m, "_category", []), (function(){return smalltalk.send((smalltalk.Array || Array), "_new", []);})]), "_add_", [m]);})]);
  4586. smalltalk.send(smalltalk.send(self, "_protocols", []), "_do_", [(function(category){return smalltalk.send(aBlock, "_value_value_", [category, smalltalk.send(methodsByCategory, "_at_", [category])]);})]);
  4587. return self;},
  4588. args: ["aBlock"],
  4589. 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)]",
  4590. messageSends: ["new", "do:", "values", "methodDictionary", "add:", "at:ifAbsentPut:", "category", "protocols", "value:value:", "at:"],
  4591. referencedClasses: ["HashedCollection", "Array"]
  4592. }),
  4593. smalltalk.Behavior);
  4594. smalltalk.addMethod(
  4595. "_prototype",
  4596. smalltalk.method({
  4597. selector: "prototype",
  4598. category: 'accessing',
  4599. fn: function (){
  4600. var self=this;
  4601. return self.fn.prototype;
  4602. return self;},
  4603. args: [],
  4604. source: "prototype\x0a\x09<return self.fn.prototype>",
  4605. messageSends: [],
  4606. referencedClasses: []
  4607. }),
  4608. smalltalk.Behavior);
  4609. smalltalk.addMethod(
  4610. "_removeCompiledMethod_",
  4611. smalltalk.method({
  4612. selector: "removeCompiledMethod:",
  4613. category: 'compiling',
  4614. fn: function (aMethod){
  4615. var self=this;
  4616. delete self.fn.prototype[aMethod.selector._asSelector()];
  4617. delete self.fn.prototype.methods[aMethod.selector];
  4618. smalltalk.init(self);;
  4619. return self;},
  4620. args: ["aMethod"],
  4621. source: "removeCompiledMethod: aMethod\x0a\x09<delete self.fn.prototype[aMethod.selector._asSelector()];\x0a\x09delete self.fn.prototype.methods[aMethod.selector];\x0a\x09smalltalk.init(self);>",
  4622. messageSends: [],
  4623. referencedClasses: []
  4624. }),
  4625. smalltalk.Behavior);
  4626. smalltalk.addMethod(
  4627. "_subclasses",
  4628. smalltalk.method({
  4629. selector: "subclasses",
  4630. category: 'accessing',
  4631. fn: function (){
  4632. var self=this;
  4633. return smalltalk.subclasses(self);
  4634. return self;},
  4635. args: [],
  4636. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  4637. messageSends: [],
  4638. referencedClasses: []
  4639. }),
  4640. smalltalk.Behavior);
  4641. smalltalk.addMethod(
  4642. "_superclass",
  4643. smalltalk.method({
  4644. selector: "superclass",
  4645. category: 'accessing',
  4646. fn: function (){
  4647. var self=this;
  4648. return self.superclass || nil;
  4649. return self;},
  4650. args: [],
  4651. source: "superclass\x0a\x09<return self.superclass || nil>",
  4652. messageSends: [],
  4653. referencedClasses: []
  4654. }),
  4655. smalltalk.Behavior);
  4656. smalltalk.addMethod(
  4657. "_withAllSubclasses",
  4658. smalltalk.method({
  4659. selector: "withAllSubclasses",
  4660. category: 'accessing',
  4661. fn: function (){
  4662. var self=this;
  4663. return (function($rec){smalltalk.send($rec, "_addAll_", [smalltalk.send(self, "_allSubclasses", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_with_", [self]));
  4664. return self;},
  4665. args: [],
  4666. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  4667. messageSends: ["addAll:", "allSubclasses", "yourself", "with:"],
  4668. referencedClasses: ["Array"]
  4669. }),
  4670. smalltalk.Behavior);
  4671. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  4672. smalltalk.Class.comment="Class is __the__ class object. \x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
  4673. smalltalk.addMethod(
  4674. "_category",
  4675. smalltalk.method({
  4676. selector: "category",
  4677. category: 'accessing',
  4678. fn: function (){
  4679. var self=this;
  4680. return (($receiver = smalltalk.send(self, "_package", [])) == nil || $receiver == undefined) ? (function(){return "Unclassified";})() : (function(){return smalltalk.send(smalltalk.send(self, "_package", []), "_name", []);})();
  4681. return self;},
  4682. args: [],
  4683. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  4684. messageSends: ["ifNil:ifNotNil:", "package", "name"],
  4685. referencedClasses: []
  4686. }),
  4687. smalltalk.Class);
  4688. smalltalk.addMethod(
  4689. "_isClass",
  4690. smalltalk.method({
  4691. selector: "isClass",
  4692. category: 'testing',
  4693. fn: function (){
  4694. var self=this;
  4695. return true;
  4696. return self;},
  4697. args: [],
  4698. source: "isClass\x0a\x09^true",
  4699. messageSends: [],
  4700. referencedClasses: []
  4701. }),
  4702. smalltalk.Class);
  4703. smalltalk.addMethod(
  4704. "_package",
  4705. smalltalk.method({
  4706. selector: "package",
  4707. category: 'accessing',
  4708. fn: function (){
  4709. var self=this;
  4710. return self.pkg;
  4711. return self;},
  4712. args: [],
  4713. source: "package\x0a\x09<return self.pkg>",
  4714. messageSends: [],
  4715. referencedClasses: []
  4716. }),
  4717. smalltalk.Class);
  4718. smalltalk.addMethod(
  4719. "_package_",
  4720. smalltalk.method({
  4721. selector: "package:",
  4722. category: 'accessing',
  4723. fn: function (aPackage){
  4724. var self=this;
  4725. self.pkg = aPackage;
  4726. return self;},
  4727. args: ["aPackage"],
  4728. source: "package: aPackage\x0a\x09<self.pkg = aPackage>",
  4729. messageSends: [],
  4730. referencedClasses: []
  4731. }),
  4732. smalltalk.Class);
  4733. smalltalk.addMethod(
  4734. "_printString",
  4735. smalltalk.method({
  4736. selector: "printString",
  4737. category: 'printing',
  4738. fn: function (){
  4739. var self=this;
  4740. return smalltalk.send(self, "_name", []);
  4741. return self;},
  4742. args: [],
  4743. source: "printString\x0a\x09^self name",
  4744. messageSends: ["name"],
  4745. referencedClasses: []
  4746. }),
  4747. smalltalk.Class);
  4748. smalltalk.addMethod(
  4749. "_rename_",
  4750. smalltalk.method({
  4751. selector: "rename:",
  4752. category: 'accessing',
  4753. fn: function (aString){
  4754. var self=this;
  4755. smalltalk[aString] = self;
  4756. delete smalltalk[self.className];
  4757. self.className = aString;
  4758. ;
  4759. return self;},
  4760. args: ["aString"],
  4761. source: "rename: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = self;\x0a\x09\x09delete smalltalk[self.className];\x0a\x09\x09self.className = aString;\x0a\x09>",
  4762. messageSends: [],
  4763. referencedClasses: []
  4764. }),
  4765. smalltalk.Class);
  4766. smalltalk.addMethod(
  4767. "_subclass_instanceVariableNames_",
  4768. smalltalk.method({
  4769. selector: "subclass:instanceVariableNames:",
  4770. category: 'class creation',
  4771. fn: function (aString, anotherString){
  4772. var self=this;
  4773. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  4774. return self;},
  4775. args: ["aString", "anotherString"],
  4776. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4777. messageSends: ["subclass:instanceVariableNames:package:"],
  4778. referencedClasses: []
  4779. }),
  4780. smalltalk.Class);
  4781. smalltalk.addMethod(
  4782. "_subclass_instanceVariableNames_category_",
  4783. smalltalk.method({
  4784. selector: "subclass:instanceVariableNames:category:",
  4785. category: 'class creation',
  4786. fn: function (aString, aString2, aString3){
  4787. var self=this;
  4788. smalltalk.send(self, "_deprecatedAPI", []);
  4789. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  4790. return self;},
  4791. args: ["aString", "aString2", "aString3"],
  4792. 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",
  4793. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4794. referencedClasses: []
  4795. }),
  4796. smalltalk.Class);
  4797. smalltalk.addMethod(
  4798. "_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_",
  4799. smalltalk.method({
  4800. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  4801. category: 'class creation',
  4802. fn: function (aString, aString2, classVars, pools, aString3){
  4803. var self=this;
  4804. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  4805. return self;},
  4806. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  4807. 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",
  4808. messageSends: ["subclass:instanceVariableNames:package:"],
  4809. referencedClasses: []
  4810. }),
  4811. smalltalk.Class);
  4812. smalltalk.addMethod(
  4813. "_subclass_instanceVariableNames_package_",
  4814. smalltalk.method({
  4815. selector: "subclass:instanceVariableNames:package:",
  4816. category: 'class creation',
  4817. fn: function (aString, aString2, aString3){
  4818. var self=this;
  4819. return smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, smalltalk.send(aString, "_asString", []), aString2, aString3]);
  4820. return self;},
  4821. args: ["aString", "aString2", "aString3"],
  4822. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  4823. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  4824. referencedClasses: ["ClassBuilder"]
  4825. }),
  4826. smalltalk.Class);
  4827. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  4828. 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."
  4829. smalltalk.addMethod(
  4830. "_instanceClass",
  4831. smalltalk.method({
  4832. selector: "instanceClass",
  4833. category: 'accessing',
  4834. fn: function (){
  4835. var self=this;
  4836. return self.instanceClass;
  4837. return self;},
  4838. args: [],
  4839. source: "instanceClass\x0a\x09<return self.instanceClass>",
  4840. messageSends: [],
  4841. referencedClasses: []
  4842. }),
  4843. smalltalk.Metaclass);
  4844. smalltalk.addMethod(
  4845. "_instanceVariableNames_",
  4846. smalltalk.method({
  4847. selector: "instanceVariableNames:",
  4848. category: 'accessing',
  4849. fn: function (aCollection){
  4850. var self=this;
  4851. smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_class_instanceVariableNames_", [self, aCollection]);
  4852. return self;},
  4853. args: ["aCollection"],
  4854. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09 class: self instanceVariableNames: aCollection",
  4855. messageSends: ["class:instanceVariableNames:", "new"],
  4856. referencedClasses: ["ClassBuilder"]
  4857. }),
  4858. smalltalk.Metaclass);
  4859. smalltalk.addMethod(
  4860. "_isMetaclass",
  4861. smalltalk.method({
  4862. selector: "isMetaclass",
  4863. category: 'testing',
  4864. fn: function (){
  4865. var self=this;
  4866. return true;
  4867. return self;},
  4868. args: [],
  4869. source: "isMetaclass\x0a\x09^true",
  4870. messageSends: [],
  4871. referencedClasses: []
  4872. }),
  4873. smalltalk.Metaclass);
  4874. smalltalk.addMethod(
  4875. "_printString",
  4876. smalltalk.method({
  4877. selector: "printString",
  4878. category: 'printing',
  4879. fn: function (){
  4880. var self=this;
  4881. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_instanceClass", []), "_name", []), "__comma", [" class"]);
  4882. return self;},
  4883. args: [],
  4884. source: "printString\x0a\x09^self instanceClass name, ' class'",
  4885. messageSends: [",", "name", "instanceClass"],
  4886. referencedClasses: []
  4887. }),
  4888. smalltalk.Metaclass);
  4889. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  4890. 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:`."
  4891. smalltalk.addMethod(
  4892. "_addSubclassOf_named_instanceVariableNames_",
  4893. smalltalk.method({
  4894. selector: "addSubclassOf:named:instanceVariableNames:",
  4895. category: 'private',
  4896. fn: function (aClass, aString, aCollection){
  4897. var self=this;
  4898. smalltalk.addClass(aString, aClass, aCollection);
  4899. return smalltalk[aString];
  4900. return self;},
  4901. args: ["aClass", "aString", "aCollection"],
  4902. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection\x0a\x09<smalltalk.addClass(aString, aClass, aCollection);\x0a\x09 return smalltalk[aString]>",
  4903. messageSends: [],
  4904. referencedClasses: []
  4905. }),
  4906. smalltalk.ClassBuilder);
  4907. smalltalk.addMethod(
  4908. "_addSubclassOf_named_instanceVariableNames_package_",
  4909. smalltalk.method({
  4910. selector: "addSubclassOf:named:instanceVariableNames:package:",
  4911. category: 'private',
  4912. fn: function (aClass, aString, aCollection, packageName){
  4913. var self=this;
  4914. smalltalk.addClass(aString, aClass, aCollection, packageName);
  4915. return smalltalk[aString];
  4916. return self;},
  4917. args: ["aClass", "aString", "aCollection", "packageName"],
  4918. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09 return smalltalk[aString]>",
  4919. messageSends: [],
  4920. referencedClasses: []
  4921. }),
  4922. smalltalk.ClassBuilder);
  4923. smalltalk.addMethod(
  4924. "_class_instanceVariableNames_",
  4925. smalltalk.method({
  4926. selector: "class:instanceVariableNames:",
  4927. category: 'class creation',
  4928. fn: function (aClass, aString){
  4929. var self=this;
  4930. ((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_name", []), "__comma", [" is not a metaclass"])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_name", []), "__comma", [" is not a metaclass"])]);})]));
  4931. smalltalk.send(aClass, "_basicAt_put_", ["iVarNames", smalltalk.send(self, "_instanceVariableNamesFor_", [aString])]);
  4932. smalltalk.send(self, "_setupClass_", [aClass]);
  4933. return self;},
  4934. args: ["aClass", "aString"],
  4935. source: "class: aClass instanceVariableNames: aString\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: (self instanceVariableNamesFor: aString).\x0a\x09self setupClass: aClass",
  4936. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:", "instanceVariableNamesFor:", "setupClass:"],
  4937. referencedClasses: []
  4938. }),
  4939. smalltalk.ClassBuilder);
  4940. smalltalk.addMethod(
  4941. "_copyClass_named_",
  4942. smalltalk.method({
  4943. selector: "copyClass:named:",
  4944. category: 'private',
  4945. fn: function (aClass, aString){
  4946. var self=this;
  4947. var newClass=nil;
  4948. (newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [smalltalk.send(aClass, "_superclass", []), aString, smalltalk.send(aClass, "_instanceVariableNames", []), smalltalk.send(smalltalk.send(aClass, "_package", []), "_name", [])]));
  4949. smalltalk.send(self, "_setupClass_", [newClass]);
  4950. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_install_forClass_category_", [smalltalk.send(each, "_source", []), newClass, smalltalk.send(each, "_category", [])]);})]);
  4951. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_install_forClass_category_", [smalltalk.send(each, "_source", []), smalltalk.send(newClass, "_class", []), smalltalk.send(each, "_category", [])]);})]);
  4952. smalltalk.send(self, "_setupClass_", [newClass]);
  4953. return newClass;
  4954. return self;},
  4955. args: ["aClass", "aString"],
  4956. 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 setupClass: newClass.\x0a\x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09Compiler new install: each source forClass: newClass category: each category].\x0a\x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09Compiler new install: each source forClass: newClass class category: each category].\x0a\x0a\x09self setupClass: newClass.\x0a\x09^newClass",
  4957. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "setupClass:", "do:", "values", "methodDictionary", "install:forClass:category:", "new", "source", "category", "class"],
  4958. referencedClasses: ["Compiler"]
  4959. }),
  4960. smalltalk.ClassBuilder);
  4961. smalltalk.addMethod(
  4962. "_instanceVariableNamesFor_",
  4963. smalltalk.method({
  4964. selector: "instanceVariableNamesFor:",
  4965. category: 'private',
  4966. fn: function (aString){
  4967. var self=this;
  4968. return smalltalk.send(smalltalk.send(aString, "_tokenize_", [" "]), "_reject_", [(function(each){return smalltalk.send(each, "_isEmpty", []);})]);
  4969. return self;},
  4970. args: ["aString"],
  4971. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [:each | each isEmpty]",
  4972. messageSends: ["reject:", "tokenize:", "isEmpty"],
  4973. referencedClasses: []
  4974. }),
  4975. smalltalk.ClassBuilder);
  4976. smalltalk.addMethod(
  4977. "_setupClass_",
  4978. smalltalk.method({
  4979. selector: "setupClass:",
  4980. category: 'private',
  4981. fn: function (aClass){
  4982. var self=this;
  4983. smalltalk.init(aClass);;
  4984. return self;},
  4985. args: ["aClass"],
  4986. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  4987. messageSends: [],
  4988. referencedClasses: []
  4989. }),
  4990. smalltalk.ClassBuilder);
  4991. smalltalk.addMethod(
  4992. "_superclass_subclass_",
  4993. smalltalk.method({
  4994. selector: "superclass:subclass:",
  4995. category: 'class creation',
  4996. fn: function (aClass, aString){
  4997. var self=this;
  4998. return smalltalk.send(self, "_superclass_subclass_instanceVariableNames_package_", [aClass, aString, "", nil]);
  4999. return self;},
  5000. args: ["aClass", "aString"],
  5001. source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
  5002. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  5003. referencedClasses: []
  5004. }),
  5005. smalltalk.ClassBuilder);
  5006. smalltalk.addMethod(
  5007. "_superclass_subclass_instanceVariableNames_package_",
  5008. smalltalk.method({
  5009. selector: "superclass:subclass:instanceVariableNames:package:",
  5010. category: 'class creation',
  5011. fn: function (aClass, aString, aString2, aString3){
  5012. var self=this;
  5013. var newClass=nil;
  5014. (newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2]), (($receiver = aString3) == nil || $receiver == undefined) ? (function(){return "unclassified";})() : $receiver]));
  5015. smalltalk.send(self, "_setupClass_", [newClass]);
  5016. return newClass;
  5017. return self;},
  5018. args: ["aClass", "aString", "aString2", "aString3"],
  5019. source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a\x09^newClass",
  5020. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:"],
  5021. referencedClasses: []
  5022. }),
  5023. smalltalk.ClassBuilder);
  5024. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel-Classes');
  5025. smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
  5026. smalltalk.addMethod(
  5027. "_class_category_",
  5028. smalltalk.method({
  5029. selector: "class:category:",
  5030. category: 'accessing',
  5031. fn: function (aClass, aString){
  5032. var self=this;
  5033. (self['@class']=aClass);
  5034. (self['@category']=aString);
  5035. return self;},
  5036. args: ["aClass", "aString"],
  5037. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  5038. messageSends: [],
  5039. referencedClasses: []
  5040. }),
  5041. smalltalk.ClassCategoryReader);
  5042. smalltalk.addMethod(
  5043. "_compileMethod_",
  5044. smalltalk.method({
  5045. selector: "compileMethod:",
  5046. category: 'private',
  5047. fn: function (aString){
  5048. var self=this;
  5049. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_install_forClass_category_", [aString, self['@class'], self['@category']]);
  5050. return self;},
  5051. args: ["aString"],
  5052. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  5053. messageSends: ["install:forClass:category:", "new"],
  5054. referencedClasses: ["Compiler"]
  5055. }),
  5056. smalltalk.ClassCategoryReader);
  5057. smalltalk.addMethod(
  5058. "_initialize",
  5059. smalltalk.method({
  5060. selector: "initialize",
  5061. category: 'initialization',
  5062. fn: function (){
  5063. var self=this;
  5064. smalltalk.send(self, "_initialize", [], smalltalk.ClassCategoryReader.superclass || nil);
  5065. (self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []));
  5066. return self;},
  5067. args: [],
  5068. source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
  5069. messageSends: ["initialize", "new"],
  5070. referencedClasses: ["ChunkParser"]
  5071. }),
  5072. smalltalk.ClassCategoryReader);
  5073. smalltalk.addMethod(
  5074. "_scanFrom_",
  5075. smalltalk.method({
  5076. selector: "scanFrom:",
  5077. category: 'fileIn',
  5078. fn: function (aChunkParser){
  5079. var self=this;
  5080. var chunk=nil;
  5081. (function(){while(!(function(){(chunk=smalltalk.send(aChunkParser, "_nextChunk", []));return smalltalk.send(chunk, "_isEmpty", []);})()) {(function(){return smalltalk.send(self, "_compileMethod_", [chunk]);})()}})();
  5082. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_setupClass_", [self['@class']]);
  5083. return self;},
  5084. args: ["aChunkParser"],
  5085. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09 self compileMethod: chunk].\x0a\x09Compiler new setupClass: class",
  5086. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"],
  5087. referencedClasses: ["Compiler"]
  5088. }),
  5089. smalltalk.ClassCategoryReader);
  5090. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel-Classes');
  5091. smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class descriptions stored on a file.\x0aSee `ClassCategoryReader` too."
  5092. smalltalk.addMethod(
  5093. "_class_",
  5094. smalltalk.method({
  5095. selector: "class:",
  5096. category: 'accessing',
  5097. fn: function (aClass){
  5098. var self=this;
  5099. (self['@class']=aClass);
  5100. return self;},
  5101. args: ["aClass"],
  5102. source: "class: aClass\x0a\x09class := aClass",
  5103. messageSends: [],
  5104. referencedClasses: []
  5105. }),
  5106. smalltalk.ClassCommentReader);
  5107. smalltalk.addMethod(
  5108. "_initialize",
  5109. smalltalk.method({
  5110. selector: "initialize",
  5111. category: 'initialization',
  5112. fn: function (){
  5113. var self=this;
  5114. smalltalk.send(self, "_initialize", [], smalltalk.ClassCommentReader.superclass || nil);
  5115. (self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []));
  5116. return self;},
  5117. args: [],
  5118. source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
  5119. messageSends: ["initialize", "new"],
  5120. referencedClasses: ["ChunkParser"]
  5121. }),
  5122. smalltalk.ClassCommentReader);
  5123. smalltalk.addMethod(
  5124. "_scanFrom_",
  5125. smalltalk.method({
  5126. selector: "scanFrom:",
  5127. category: 'fileIn',
  5128. fn: function (aChunkParser){
  5129. var self=this;
  5130. var chunk=nil;
  5131. (chunk=smalltalk.send(aChunkParser, "_nextChunk", []));
  5132. ((($receiver = smalltalk.send(chunk, "_isEmpty", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_setComment_", [chunk]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_setComment_", [chunk]);})]));
  5133. return self;},
  5134. args: ["aChunkParser"],
  5135. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09 self setComment: chunk].",
  5136. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
  5137. referencedClasses: []
  5138. }),
  5139. smalltalk.ClassCommentReader);
  5140. smalltalk.addMethod(
  5141. "_setComment_",
  5142. smalltalk.method({
  5143. selector: "setComment:",
  5144. category: 'private',
  5145. fn: function (aString){
  5146. var self=this;
  5147. smalltalk.send(self['@class'], "_comment_", [aString]);
  5148. return self;},
  5149. args: ["aString"],
  5150. source: "setComment: aString\x0a class comment: aString",
  5151. messageSends: ["comment:"],
  5152. referencedClasses: []
  5153. }),
  5154. smalltalk.ClassCommentReader);
  5155. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  5156. smalltalk.addMethod(
  5157. "_getNodesFrom_",
  5158. smalltalk.method({
  5159. selector: "getNodesFrom:",
  5160. category: 'accessing',
  5161. fn: function (aCollection){
  5162. var self=this;
  5163. var children=nil;
  5164. var others=nil;
  5165. (children=[]);
  5166. (others=[]);
  5167. smalltalk.send(aCollection, "_do_", [(function(each){return ((($receiver = smalltalk.send(smalltalk.send(each, "_superclass", []), "__eq", [smalltalk.send(self, "_theClass", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(children, "_add_", [each]);})() : (function(){return smalltalk.send(others, "_add_", [each]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(children, "_add_", [each]);}), (function(){return smalltalk.send(others, "_add_", [each]);})]));})]);
  5168. (self['@nodes']=smalltalk.send(children, "_collect_", [(function(each){return smalltalk.send((smalltalk.ClassSorterNode || ClassSorterNode), "_on_classes_level_", [each, others, ((($receiver = smalltalk.send(self, "_level", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);})]));
  5169. return self;},
  5170. args: ["aCollection"],
  5171. 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]",
  5172. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"],
  5173. referencedClasses: ["ClassSorterNode"]
  5174. }),
  5175. smalltalk.ClassSorterNode);
  5176. smalltalk.addMethod(
  5177. "_level",
  5178. smalltalk.method({
  5179. selector: "level",
  5180. category: 'accessing',
  5181. fn: function (){
  5182. var self=this;
  5183. return self['@level'];
  5184. return self;},
  5185. args: [],
  5186. source: "level\x0a\x09^level",
  5187. messageSends: [],
  5188. referencedClasses: []
  5189. }),
  5190. smalltalk.ClassSorterNode);
  5191. smalltalk.addMethod(
  5192. "_level_",
  5193. smalltalk.method({
  5194. selector: "level:",
  5195. category: 'accessing',
  5196. fn: function (anInteger){
  5197. var self=this;
  5198. (self['@level']=anInteger);
  5199. return self;},
  5200. args: ["anInteger"],
  5201. source: "level: anInteger\x0a\x09level := anInteger",
  5202. messageSends: [],
  5203. referencedClasses: []
  5204. }),
  5205. smalltalk.ClassSorterNode);
  5206. smalltalk.addMethod(
  5207. "_nodes",
  5208. smalltalk.method({
  5209. selector: "nodes",
  5210. category: 'accessing',
  5211. fn: function (){
  5212. var self=this;
  5213. return self['@nodes'];
  5214. return self;},
  5215. args: [],
  5216. source: "nodes\x0a\x09^nodes",
  5217. messageSends: [],
  5218. referencedClasses: []
  5219. }),
  5220. smalltalk.ClassSorterNode);
  5221. smalltalk.addMethod(
  5222. "_theClass",
  5223. smalltalk.method({
  5224. selector: "theClass",
  5225. category: 'accessing',
  5226. fn: function (){
  5227. var self=this;
  5228. return self['@theClass'];
  5229. return self;},
  5230. args: [],
  5231. source: "theClass\x0a\x09^theClass",
  5232. messageSends: [],
  5233. referencedClasses: []
  5234. }),
  5235. smalltalk.ClassSorterNode);
  5236. smalltalk.addMethod(
  5237. "_theClass_",
  5238. smalltalk.method({
  5239. selector: "theClass:",
  5240. category: 'accessing',
  5241. fn: function (aClass){
  5242. var self=this;
  5243. (self['@theClass']=aClass);
  5244. return self;},
  5245. args: ["aClass"],
  5246. source: "theClass: aClass\x0a\x09theClass := aClass",
  5247. messageSends: [],
  5248. referencedClasses: []
  5249. }),
  5250. smalltalk.ClassSorterNode);
  5251. smalltalk.addMethod(
  5252. "_traverseClassesWith_",
  5253. smalltalk.method({
  5254. selector: "traverseClassesWith:",
  5255. category: 'visiting',
  5256. fn: function (aCollection){
  5257. var self=this;
  5258. smalltalk.send(aCollection, "_add_", [smalltalk.send(self, "_theClass", [])]);
  5259. smalltalk.send(smalltalk.send(smalltalk.send(self, "_nodes", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(smalltalk.send(a, "_theClass", []), "_name", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", [])]));})]), "_do_", [(function(aNode){return smalltalk.send(aNode, "_traverseClassesWith_", [aCollection]);})]);
  5260. return self;},
  5261. args: ["aCollection"],
  5262. 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 ].",
  5263. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"],
  5264. referencedClasses: []
  5265. }),
  5266. smalltalk.ClassSorterNode);
  5267. smalltalk.addMethod(
  5268. "_on_classes_level_",
  5269. smalltalk.method({
  5270. selector: "on:classes:level:",
  5271. category: 'instance creation',
  5272. fn: function (aClass, aCollection, anInteger){
  5273. var self=this;
  5274. return (function($rec){smalltalk.send($rec, "_theClass_", [aClass]);smalltalk.send($rec, "_level_", [anInteger]);smalltalk.send($rec, "_getNodesFrom_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  5275. return self;},
  5276. args: ["aClass", "aCollection", "anInteger"],
  5277. 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",
  5278. messageSends: ["theClass:", "level:", "getNodesFrom:", "yourself", "new"],
  5279. referencedClasses: []
  5280. }),
  5281. smalltalk.ClassSorterNode.klass);
  5282. smalltalk.addPackage('Kernel-Methods', {});
  5283. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  5284. 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."
  5285. smalltalk.addMethod(
  5286. "_applyTo_arguments_",
  5287. smalltalk.method({
  5288. selector: "applyTo:arguments:",
  5289. category: 'evaluating',
  5290. fn: function (anObject, aCollection){
  5291. var self=this;
  5292. return self.apply(anObject, aCollection);
  5293. return self;},
  5294. args: ["anObject", "aCollection"],
  5295. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  5296. messageSends: [],
  5297. referencedClasses: []
  5298. }),
  5299. smalltalk.BlockClosure);
  5300. smalltalk.addMethod(
  5301. "_compiledSource",
  5302. smalltalk.method({
  5303. selector: "compiledSource",
  5304. category: 'accessing',
  5305. fn: function (){
  5306. var self=this;
  5307. return self.toString();
  5308. return self;},
  5309. args: [],
  5310. source: "compiledSource\x0a\x09<return self.toString()>",
  5311. messageSends: [],
  5312. referencedClasses: []
  5313. }),
  5314. smalltalk.BlockClosure);
  5315. smalltalk.addMethod(
  5316. "_ensure_",
  5317. smalltalk.method({
  5318. selector: "ensure:",
  5319. category: 'evaluating',
  5320. fn: function (aBlock){
  5321. var self=this;
  5322. var success=nil;
  5323. (success=false);
  5324. return smalltalk.send((function(){smalltalk.send(self, "_value", []);(success=true);return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]);
  5325. return self;},
  5326. args: ["aBlock"],
  5327. source: "ensure: aBlock\x0a\x09| success |\x0a\x09success := false.\x0a\x09^[self value. success := true. aBlock value]\x0a\x09\x09on: Error\x0a\x09\x09do: [:ex |\x0a\x09\x09\x09success ifFalse: [aBlock value].\x0a\x09\x09\x09ex signal]",
  5328. messageSends: ["on:do:", "value", "ifFalse:", "signal"],
  5329. referencedClasses: ["Error"]
  5330. }),
  5331. smalltalk.BlockClosure);
  5332. smalltalk.addMethod(
  5333. "_new",
  5334. smalltalk.method({
  5335. selector: "new",
  5336. category: 'evaluating',
  5337. fn: function (){
  5338. var self=this;
  5339. return new self();
  5340. return self;},
  5341. args: [],
  5342. 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()>",
  5343. messageSends: [],
  5344. referencedClasses: []
  5345. }),
  5346. smalltalk.BlockClosure);
  5347. smalltalk.addMethod(
  5348. "_newValue_",
  5349. smalltalk.method({
  5350. selector: "newValue:",
  5351. category: 'evaluating',
  5352. fn: function (anObject){
  5353. var self=this;
  5354. return new self(anObject);
  5355. return self;},
  5356. args: ["anObject"],
  5357. 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)>",
  5358. messageSends: [],
  5359. referencedClasses: []
  5360. }),
  5361. smalltalk.BlockClosure);
  5362. smalltalk.addMethod(
  5363. "_newValue_value_",
  5364. smalltalk.method({
  5365. selector: "newValue:value:",
  5366. category: 'evaluating',
  5367. fn: function (anObject, anObject2){
  5368. var self=this;
  5369. return new self(anObject, anObject2);
  5370. return self;},
  5371. args: ["anObject", "anObject2"],
  5372. 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)>",
  5373. messageSends: [],
  5374. referencedClasses: []
  5375. }),
  5376. smalltalk.BlockClosure);
  5377. smalltalk.addMethod(
  5378. "_newValue_value_value_",
  5379. smalltalk.method({
  5380. selector: "newValue:value:value:",
  5381. category: 'evaluating',
  5382. fn: function (anObject, anObject2, anObject3){
  5383. var self=this;
  5384. return new self(anObject, anObject2);
  5385. return self;},
  5386. args: ["anObject", "anObject2", "anObject3"],
  5387. 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)>",
  5388. messageSends: [],
  5389. referencedClasses: []
  5390. }),
  5391. smalltalk.BlockClosure);
  5392. smalltalk.addMethod(
  5393. "_numArgs",
  5394. smalltalk.method({
  5395. selector: "numArgs",
  5396. category: 'accessing',
  5397. fn: function (){
  5398. var self=this;
  5399. return self.length;
  5400. return self;},
  5401. args: [],
  5402. source: "numArgs\x0a\x09<return self.length>",
  5403. messageSends: [],
  5404. referencedClasses: []
  5405. }),
  5406. smalltalk.BlockClosure);
  5407. smalltalk.addMethod(
  5408. "_on_do_",
  5409. smalltalk.method({
  5410. selector: "on:do:",
  5411. category: 'error handling',
  5412. fn: function (anErrorClass, aBlock){
  5413. var self=this;
  5414. return smalltalk.send(self, "_try_catch_", [self, (function(error){return ((($receiver = smalltalk.send(error, "_isKindOf_", [anErrorClass])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aBlock, "_value_", [error]);})() : (function(){return smalltalk.send(error, "_signal", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [error]);}), (function(){return smalltalk.send(error, "_signal", []);})]));})]);
  5415. return self;},
  5416. args: ["anErrorClass", "aBlock"],
  5417. source: "on: anErrorClass do: aBlock\x0a\x09^self try: self catch: [:error |\x0a\x09 (error isKindOf: anErrorClass) \x0a\x09 ifTrue: [aBlock value: error]\x0a\x09 ifFalse: [error signal]]",
  5418. messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "value:", "signal"],
  5419. referencedClasses: []
  5420. }),
  5421. smalltalk.BlockClosure);
  5422. smalltalk.addMethod(
  5423. "_timeToRun",
  5424. smalltalk.method({
  5425. selector: "timeToRun",
  5426. category: 'evaluating',
  5427. fn: function (){
  5428. var self=this;
  5429. return smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [self]);
  5430. return self;},
  5431. args: [],
  5432. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  5433. messageSends: ["millisecondsToRun:"],
  5434. referencedClasses: ["Date"]
  5435. }),
  5436. smalltalk.BlockClosure);
  5437. smalltalk.addMethod(
  5438. "_value",
  5439. smalltalk.method({
  5440. selector: "value",
  5441. category: 'evaluating',
  5442. fn: function (){
  5443. var self=this;
  5444. return self();;
  5445. return self;},
  5446. args: [],
  5447. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  5448. messageSends: [],
  5449. referencedClasses: []
  5450. }),
  5451. smalltalk.BlockClosure);
  5452. smalltalk.addMethod(
  5453. "_value_",
  5454. smalltalk.method({
  5455. selector: "value:",
  5456. category: 'evaluating',
  5457. fn: function (anArg){
  5458. var self=this;
  5459. return self(anArg);;
  5460. return self;},
  5461. args: ["anArg"],
  5462. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  5463. messageSends: [],
  5464. referencedClasses: []
  5465. }),
  5466. smalltalk.BlockClosure);
  5467. smalltalk.addMethod(
  5468. "_value_value_",
  5469. smalltalk.method({
  5470. selector: "value:value:",
  5471. category: 'evaluating',
  5472. fn: function (firstArg, secondArg){
  5473. var self=this;
  5474. return self(firstArg, secondArg);;
  5475. return self;},
  5476. args: ["firstArg", "secondArg"],
  5477. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  5478. messageSends: [],
  5479. referencedClasses: []
  5480. }),
  5481. smalltalk.BlockClosure);
  5482. smalltalk.addMethod(
  5483. "_value_value_value_",
  5484. smalltalk.method({
  5485. selector: "value:value:value:",
  5486. category: 'evaluating',
  5487. fn: function (firstArg, secondArg, thirdArg){
  5488. var self=this;
  5489. return self(firstArg, secondArg, thirdArg);;
  5490. return self;},
  5491. args: ["firstArg", "secondArg", "thirdArg"],
  5492. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  5493. messageSends: [],
  5494. referencedClasses: []
  5495. }),
  5496. smalltalk.BlockClosure);
  5497. smalltalk.addMethod(
  5498. "_valueWithInterval_",
  5499. smalltalk.method({
  5500. selector: "valueWithInterval:",
  5501. category: 'timeout/interval',
  5502. fn: function (aNumber){
  5503. var self=this;
  5504. return setInterval(self, aNumber);
  5505. return self;},
  5506. args: ["aNumber"],
  5507. source: "valueWithInterval: aNumber\x0a\x09<return setInterval(self, aNumber)>",
  5508. messageSends: [],
  5509. referencedClasses: []
  5510. }),
  5511. smalltalk.BlockClosure);
  5512. smalltalk.addMethod(
  5513. "_valueWithPossibleArguments_",
  5514. smalltalk.method({
  5515. selector: "valueWithPossibleArguments:",
  5516. category: 'evaluating',
  5517. fn: function (aCollection){
  5518. var self=this;
  5519. return self.apply(null, aCollection);;
  5520. return self;},
  5521. args: ["aCollection"],
  5522. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  5523. messageSends: [],
  5524. referencedClasses: []
  5525. }),
  5526. smalltalk.BlockClosure);
  5527. smalltalk.addMethod(
  5528. "_valueWithTimeout_",
  5529. smalltalk.method({
  5530. selector: "valueWithTimeout:",
  5531. category: 'timeout/interval',
  5532. fn: function (aNumber){
  5533. var self=this;
  5534. return setTimeout(self, aNumber);
  5535. return self;},
  5536. args: ["aNumber"],
  5537. source: "valueWithTimeout: aNumber\x0a\x09<return setTimeout(self, aNumber)>",
  5538. messageSends: [],
  5539. referencedClasses: []
  5540. }),
  5541. smalltalk.BlockClosure);
  5542. smalltalk.addMethod(
  5543. "_whileFalse",
  5544. smalltalk.method({
  5545. selector: "whileFalse",
  5546. category: 'controlling',
  5547. fn: function (){
  5548. var self=this;
  5549. smalltalk.send(self, "_whileFalse_", [(function(){return nil;})]);
  5550. return self;},
  5551. args: [],
  5552. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  5553. messageSends: ["whileFalse:"],
  5554. referencedClasses: []
  5555. }),
  5556. smalltalk.BlockClosure);
  5557. smalltalk.addMethod(
  5558. "_whileFalse_",
  5559. smalltalk.method({
  5560. selector: "whileFalse:",
  5561. category: 'controlling',
  5562. fn: function (aBlock){
  5563. var self=this;
  5564. while(!self()) {aBlock()};
  5565. return self;},
  5566. args: ["aBlock"],
  5567. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  5568. messageSends: [],
  5569. referencedClasses: []
  5570. }),
  5571. smalltalk.BlockClosure);
  5572. smalltalk.addMethod(
  5573. "_whileTrue",
  5574. smalltalk.method({
  5575. selector: "whileTrue",
  5576. category: 'controlling',
  5577. fn: function (){
  5578. var self=this;
  5579. smalltalk.send(self, "_whileTrue_", [(function(){return nil;})]);
  5580. return self;},
  5581. args: [],
  5582. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  5583. messageSends: ["whileTrue:"],
  5584. referencedClasses: []
  5585. }),
  5586. smalltalk.BlockClosure);
  5587. smalltalk.addMethod(
  5588. "_whileTrue_",
  5589. smalltalk.method({
  5590. selector: "whileTrue:",
  5591. category: 'controlling',
  5592. fn: function (aBlock){
  5593. var self=this;
  5594. while(self()) {aBlock()};
  5595. return self;},
  5596. args: ["aBlock"],
  5597. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  5598. messageSends: [],
  5599. referencedClasses: []
  5600. }),
  5601. smalltalk.BlockClosure);
  5602. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  5603. 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"
  5604. smalltalk.addMethod(
  5605. "_arguments",
  5606. smalltalk.method({
  5607. selector: "arguments",
  5608. category: 'accessing',
  5609. fn: function (){
  5610. var self=this;
  5611. return self.args || [];
  5612. return self;},
  5613. args: [],
  5614. source: "arguments\x0a\x09<return self.args || []>",
  5615. messageSends: [],
  5616. referencedClasses: []
  5617. }),
  5618. smalltalk.CompiledMethod);
  5619. smalltalk.addMethod(
  5620. "_category",
  5621. smalltalk.method({
  5622. selector: "category",
  5623. category: 'accessing',
  5624. fn: function (){
  5625. var self=this;
  5626. return (($receiver = smalltalk.send(self, "_basicAt_", ["category"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  5627. return self;},
  5628. args: [],
  5629. source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
  5630. messageSends: ["ifNil:", "basicAt:"],
  5631. referencedClasses: []
  5632. }),
  5633. smalltalk.CompiledMethod);
  5634. smalltalk.addMethod(
  5635. "_category_",
  5636. smalltalk.method({
  5637. selector: "category:",
  5638. category: 'accessing',
  5639. fn: function (aString){
  5640. var self=this;
  5641. smalltalk.send(self, "_basicAt_put_", ["category", aString]);
  5642. return self;},
  5643. args: ["aString"],
  5644. source: "category: aString\x0a\x09self basicAt: 'category' put: aString",
  5645. messageSends: ["basicAt:put:"],
  5646. referencedClasses: []
  5647. }),
  5648. smalltalk.CompiledMethod);
  5649. smalltalk.addMethod(
  5650. "_fn",
  5651. smalltalk.method({
  5652. selector: "fn",
  5653. category: 'accessing',
  5654. fn: function (){
  5655. var self=this;
  5656. return smalltalk.send(self, "_basicAt_", ["fn"]);
  5657. return self;},
  5658. args: [],
  5659. source: "fn\x0a\x09^self basicAt: 'fn'",
  5660. messageSends: ["basicAt:"],
  5661. referencedClasses: []
  5662. }),
  5663. smalltalk.CompiledMethod);
  5664. smalltalk.addMethod(
  5665. "_fn_",
  5666. smalltalk.method({
  5667. selector: "fn:",
  5668. category: 'accessing',
  5669. fn: function (aBlock){
  5670. var self=this;
  5671. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  5672. return self;},
  5673. args: ["aBlock"],
  5674. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  5675. messageSends: ["basicAt:put:"],
  5676. referencedClasses: []
  5677. }),
  5678. smalltalk.CompiledMethod);
  5679. smalltalk.addMethod(
  5680. "_messageSends",
  5681. smalltalk.method({
  5682. selector: "messageSends",
  5683. category: 'accessing',
  5684. fn: function (){
  5685. var self=this;
  5686. return smalltalk.send(self, "_basicAt_", ["messageSends"]);
  5687. return self;},
  5688. args: [],
  5689. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  5690. messageSends: ["basicAt:"],
  5691. referencedClasses: []
  5692. }),
  5693. smalltalk.CompiledMethod);
  5694. smalltalk.addMethod(
  5695. "_methodClass",
  5696. smalltalk.method({
  5697. selector: "methodClass",
  5698. category: 'accessing',
  5699. fn: function (){
  5700. var self=this;
  5701. return smalltalk.send(self, "_basicAt_", ["methodClass"]);
  5702. return self;},
  5703. args: [],
  5704. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  5705. messageSends: ["basicAt:"],
  5706. referencedClasses: []
  5707. }),
  5708. smalltalk.CompiledMethod);
  5709. smalltalk.addMethod(
  5710. "_referencedClasses",
  5711. smalltalk.method({
  5712. selector: "referencedClasses",
  5713. category: 'accessing',
  5714. fn: function (){
  5715. var self=this;
  5716. return smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  5717. return self;},
  5718. args: [],
  5719. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  5720. messageSends: ["basicAt:"],
  5721. referencedClasses: []
  5722. }),
  5723. smalltalk.CompiledMethod);
  5724. smalltalk.addMethod(
  5725. "_selector",
  5726. smalltalk.method({
  5727. selector: "selector",
  5728. category: 'accessing',
  5729. fn: function (){
  5730. var self=this;
  5731. return smalltalk.send(self, "_basicAt_", ["selector"]);
  5732. return self;},
  5733. args: [],
  5734. source: "selector\x0a\x09^self basicAt: 'selector'",
  5735. messageSends: ["basicAt:"],
  5736. referencedClasses: []
  5737. }),
  5738. smalltalk.CompiledMethod);
  5739. smalltalk.addMethod(
  5740. "_selector_",
  5741. smalltalk.method({
  5742. selector: "selector:",
  5743. category: 'accessing',
  5744. fn: function (aString){
  5745. var self=this;
  5746. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  5747. return self;},
  5748. args: ["aString"],
  5749. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  5750. messageSends: ["basicAt:put:"],
  5751. referencedClasses: []
  5752. }),
  5753. smalltalk.CompiledMethod);
  5754. smalltalk.addMethod(
  5755. "_source",
  5756. smalltalk.method({
  5757. selector: "source",
  5758. category: 'accessing',
  5759. fn: function (){
  5760. var self=this;
  5761. return (($receiver = smalltalk.send(self, "_basicAt_", ["source"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  5762. return self;},
  5763. args: [],
  5764. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  5765. messageSends: ["ifNil:", "basicAt:"],
  5766. referencedClasses: []
  5767. }),
  5768. smalltalk.CompiledMethod);
  5769. smalltalk.addMethod(
  5770. "_source_",
  5771. smalltalk.method({
  5772. selector: "source:",
  5773. category: 'accessing',
  5774. fn: function (aString){
  5775. var self=this;
  5776. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  5777. return self;},
  5778. args: ["aString"],
  5779. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  5780. messageSends: ["basicAt:put:"],
  5781. referencedClasses: []
  5782. }),
  5783. smalltalk.CompiledMethod);
  5784. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  5785. 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:`"
  5786. smalltalk.addMethod(
  5787. "_arguments",
  5788. smalltalk.method({
  5789. selector: "arguments",
  5790. category: 'accessing',
  5791. fn: function (){
  5792. var self=this;
  5793. return self['@arguments'];
  5794. return self;},
  5795. args: [],
  5796. source: "arguments\x0a\x09^arguments",
  5797. messageSends: [],
  5798. referencedClasses: []
  5799. }),
  5800. smalltalk.Message);
  5801. smalltalk.addMethod(
  5802. "_arguments_",
  5803. smalltalk.method({
  5804. selector: "arguments:",
  5805. category: 'accessing',
  5806. fn: function (anArray){
  5807. var self=this;
  5808. (self['@arguments']=anArray);
  5809. return self;},
  5810. args: ["anArray"],
  5811. source: "arguments: anArray\x0a\x09arguments := anArray",
  5812. messageSends: [],
  5813. referencedClasses: []
  5814. }),
  5815. smalltalk.Message);
  5816. smalltalk.addMethod(
  5817. "_printString",
  5818. smalltalk.method({
  5819. selector: "printString",
  5820. category: 'printing',
  5821. fn: function (){
  5822. var self=this;
  5823. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Message.superclass || nil)]);smalltalk.send($rec, "_nextPutAll_", ["("]);smalltalk.send($rec, "_nextPutAll_", [self['@selector']]);return smalltalk.send($rec, "_nextPutAll_", [")"]);})(aStream);})]);
  5824. return self;},
  5825. args: [],
  5826. 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]",
  5827. messageSends: ["streamContents:", "nextPutAll:", "printString"],
  5828. referencedClasses: ["String"]
  5829. }),
  5830. smalltalk.Message);
  5831. smalltalk.addMethod(
  5832. "_selector",
  5833. smalltalk.method({
  5834. selector: "selector",
  5835. category: 'accessing',
  5836. fn: function (){
  5837. var self=this;
  5838. return self['@selector'];
  5839. return self;},
  5840. args: [],
  5841. source: "selector\x0a\x09^selector",
  5842. messageSends: [],
  5843. referencedClasses: []
  5844. }),
  5845. smalltalk.Message);
  5846. smalltalk.addMethod(
  5847. "_selector_",
  5848. smalltalk.method({
  5849. selector: "selector:",
  5850. category: 'accessing',
  5851. fn: function (aString){
  5852. var self=this;
  5853. (self['@selector']=aString);
  5854. return self;},
  5855. args: ["aString"],
  5856. source: "selector: aString\x0a\x09selector := aString",
  5857. messageSends: [],
  5858. referencedClasses: []
  5859. }),
  5860. smalltalk.Message);
  5861. smalltalk.addMethod(
  5862. "_sendTo_",
  5863. smalltalk.method({
  5864. selector: "sendTo:",
  5865. category: 'printing',
  5866. fn: function (anObject){
  5867. var self=this;
  5868. smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
  5869. return self;},
  5870. args: ["anObject"],
  5871. source: "sendTo: anObject\x0a\x09Smalltalk current send: self selector to: anObject arguments: self arguments",
  5872. messageSends: ["send:to:arguments:", "current", "selector", "arguments"],
  5873. referencedClasses: ["Smalltalk"]
  5874. }),
  5875. smalltalk.Message);
  5876. smalltalk.addMethod(
  5877. "_selector_arguments_",
  5878. smalltalk.method({
  5879. selector: "selector:arguments:",
  5880. category: 'instance creation',
  5881. fn: function (aString, anArray){
  5882. var self=this;
  5883. return (function($rec){smalltalk.send($rec, "_selector_", [aString]);smalltalk.send($rec, "_arguments_", [anArray]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  5884. return self;},
  5885. args: ["aString", "anArray"],
  5886. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  5887. messageSends: ["selector:", "arguments:", "yourself", "new"],
  5888. referencedClasses: []
  5889. }),
  5890. smalltalk.Message.klass);
  5891. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  5892. 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 \x0a\x0aCurrent limitation: MethodContext instances are not created on Block evaluation. That means it's actually impossible to debug inside a Block."
  5893. smalltalk.addMethod(
  5894. "_asString",
  5895. smalltalk.method({
  5896. selector: "asString",
  5897. category: 'accessing',
  5898. fn: function (){
  5899. var self=this;
  5900. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
  5901. return self;},
  5902. args: [],
  5903. source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
  5904. messageSends: [",", "printString", "class", "receiver", "selector"],
  5905. referencedClasses: []
  5906. }),
  5907. smalltalk.MethodContext);
  5908. smalltalk.addMethod(
  5909. "_home",
  5910. smalltalk.method({
  5911. selector: "home",
  5912. category: 'accessing',
  5913. fn: function (){
  5914. var self=this;
  5915. return self.homeContext;
  5916. return self;},
  5917. args: [],
  5918. source: "home\x0a\x09<return self.homeContext>",
  5919. messageSends: [],
  5920. referencedClasses: []
  5921. }),
  5922. smalltalk.MethodContext);
  5923. smalltalk.addMethod(
  5924. "_printString",
  5925. smalltalk.method({
  5926. selector: "printString",
  5927. category: 'accessing',
  5928. fn: function (){
  5929. var self=this;
  5930. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.MethodContext.superclass || nil), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
  5931. return self;},
  5932. args: [],
  5933. source: "printString\x0a\x09^super printString, '(', self asString, ')'",
  5934. messageSends: [",", "printString", "asString"],
  5935. referencedClasses: []
  5936. }),
  5937. smalltalk.MethodContext);
  5938. smalltalk.addMethod(
  5939. "_receiver",
  5940. smalltalk.method({
  5941. selector: "receiver",
  5942. category: 'accessing',
  5943. fn: function (){
  5944. var self=this;
  5945. return self.receiver;
  5946. return self;},
  5947. args: [],
  5948. source: "receiver\x0a\x09<return self.receiver>",
  5949. messageSends: [],
  5950. referencedClasses: []
  5951. }),
  5952. smalltalk.MethodContext);
  5953. smalltalk.addMethod(
  5954. "_selector",
  5955. smalltalk.method({
  5956. selector: "selector",
  5957. category: 'accessing',
  5958. fn: function (){
  5959. var self=this;
  5960. return smalltalk.convertSelector(self.selector);
  5961. return self;},
  5962. args: [],
  5963. source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
  5964. messageSends: [],
  5965. referencedClasses: []
  5966. }),
  5967. smalltalk.MethodContext);
  5968. smalltalk.addMethod(
  5969. "_temps",
  5970. smalltalk.method({
  5971. selector: "temps",
  5972. category: 'accessing',
  5973. fn: function (){
  5974. var self=this;
  5975. return self.temps;
  5976. return self;},
  5977. args: [],
  5978. source: "temps\x0a\x09<return self.temps>",
  5979. messageSends: [],
  5980. referencedClasses: []
  5981. }),
  5982. smalltalk.MethodContext);
  5983. smalltalk.addPackage('Kernel-Collections', {});
  5984. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  5985. smalltalk.addMethod(
  5986. "__eq",
  5987. smalltalk.method({
  5988. selector: "=",
  5989. category: 'comparing',
  5990. fn: function (anAssociation){
  5991. var self=this;
  5992. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
  5993. return self;},
  5994. args: ["anAssociation"],
  5995. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09 self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  5996. messageSends: ["and:", "=", "class", "key", "value"],
  5997. referencedClasses: []
  5998. }),
  5999. smalltalk.Association);
  6000. smalltalk.addMethod(
  6001. "_key",
  6002. smalltalk.method({
  6003. selector: "key",
  6004. category: 'accessing',
  6005. fn: function (){
  6006. var self=this;
  6007. return self['@key'];
  6008. return self;},
  6009. args: [],
  6010. source: "key\x0a\x09^key",
  6011. messageSends: [],
  6012. referencedClasses: []
  6013. }),
  6014. smalltalk.Association);
  6015. smalltalk.addMethod(
  6016. "_key_",
  6017. smalltalk.method({
  6018. selector: "key:",
  6019. category: 'accessing',
  6020. fn: function (aKey){
  6021. var self=this;
  6022. (self['@key']=aKey);
  6023. return self;},
  6024. args: ["aKey"],
  6025. source: "key: aKey\x0a\x09key := aKey",
  6026. messageSends: [],
  6027. referencedClasses: []
  6028. }),
  6029. smalltalk.Association);
  6030. smalltalk.addMethod(
  6031. "_storeOn_",
  6032. smalltalk.method({
  6033. selector: "storeOn:",
  6034. category: 'comparing',
  6035. fn: function (aStream){
  6036. var self=this;
  6037. smalltalk.send(self['@key'], "_storeOn_", [aStream]);
  6038. smalltalk.send(aStream, "_nextPutAll_", ["->"]);
  6039. smalltalk.send(self['@value'], "_storeOn_", [aStream]);
  6040. return self;},
  6041. args: ["aStream"],
  6042. source: "storeOn: aStream\x0a\x09\x22Store in the format (key->value)\x22\x0a\x0a\x09\x22aStream nextPutAll: '('.\x22\x0a\x09key storeOn: aStream.\x0a\x09aStream nextPutAll: '->'.\x0a\x09value storeOn: aStream.\x0a\x09\x22aStream nextPutAll: ')'\x22",
  6043. messageSends: ["storeOn:", "nextPutAll:"],
  6044. referencedClasses: []
  6045. }),
  6046. smalltalk.Association);
  6047. smalltalk.addMethod(
  6048. "_value",
  6049. smalltalk.method({
  6050. selector: "value",
  6051. category: 'accessing',
  6052. fn: function (){
  6053. var self=this;
  6054. return self['@value'];
  6055. return self;},
  6056. args: [],
  6057. source: "value\x0a\x09^value",
  6058. messageSends: [],
  6059. referencedClasses: []
  6060. }),
  6061. smalltalk.Association);
  6062. smalltalk.addMethod(
  6063. "_value_",
  6064. smalltalk.method({
  6065. selector: "value:",
  6066. category: 'accessing',
  6067. fn: function (aValue){
  6068. var self=this;
  6069. (self['@value']=aValue);
  6070. return self;},
  6071. args: ["aValue"],
  6072. source: "value: aValue\x0a\x09value := aValue",
  6073. messageSends: [],
  6074. referencedClasses: []
  6075. }),
  6076. smalltalk.Association);
  6077. smalltalk.addMethod(
  6078. "_key_value_",
  6079. smalltalk.method({
  6080. selector: "key:value:",
  6081. category: 'instance creation',
  6082. fn: function (aKey, aValue){
  6083. var self=this;
  6084. return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  6085. return self;},
  6086. args: ["aKey", "aValue"],
  6087. source: "key: aKey value: aValue\x0a\x09 ^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  6088. messageSends: ["key:", "value:", "yourself", "new"],
  6089. referencedClasses: []
  6090. }),
  6091. smalltalk.Association.klass);
  6092. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  6093. smalltalk.addMethod(
  6094. "__comma",
  6095. smalltalk.method({
  6096. selector: ",",
  6097. category: 'copying',
  6098. fn: function (aCollection){
  6099. var self=this;
  6100. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  6101. return self;},
  6102. args: ["aCollection"],
  6103. source: ", aCollection\x0a\x09^self copy \x0a\x09 addAll: aCollection; \x0a\x09 yourself",
  6104. messageSends: ["addAll:", "yourself", "copy"],
  6105. referencedClasses: []
  6106. }),
  6107. smalltalk.Collection);
  6108. smalltalk.addMethod(
  6109. "_add_",
  6110. smalltalk.method({
  6111. selector: "add:",
  6112. category: 'adding/removing',
  6113. fn: function (anObject){
  6114. var self=this;
  6115. smalltalk.send(self, "_subclassResponsibility", []);
  6116. return self;},
  6117. args: ["anObject"],
  6118. source: "add: anObject\x0a\x09self subclassResponsibility",
  6119. messageSends: ["subclassResponsibility"],
  6120. referencedClasses: []
  6121. }),
  6122. smalltalk.Collection);
  6123. smalltalk.addMethod(
  6124. "_addAll_",
  6125. smalltalk.method({
  6126. selector: "addAll:",
  6127. category: 'adding/removing',
  6128. fn: function (aCollection){
  6129. var self=this;
  6130. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_add_", [each]);})]);
  6131. return aCollection;
  6132. return self;},
  6133. args: ["aCollection"],
  6134. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self add: each].\x0a\x09^aCollection",
  6135. messageSends: ["do:", "add:"],
  6136. referencedClasses: []
  6137. }),
  6138. smalltalk.Collection);
  6139. smalltalk.addMethod(
  6140. "_asArray",
  6141. smalltalk.method({
  6142. selector: "asArray",
  6143. category: 'converting',
  6144. fn: function (){
  6145. var self=this;
  6146. return smalltalk.send((smalltalk.Array || Array), "_withAll_", [self]);
  6147. return self;},
  6148. args: [],
  6149. source: "asArray\x0a\x09^Array withAll: self",
  6150. messageSends: ["withAll:"],
  6151. referencedClasses: ["Array"]
  6152. }),
  6153. smalltalk.Collection);
  6154. smalltalk.addMethod(
  6155. "_asJSON",
  6156. smalltalk.method({
  6157. selector: "asJSON",
  6158. category: 'converting',
  6159. fn: function (){
  6160. var self=this;
  6161. return smalltalk.send(smalltalk.send(self, "_asArray", []), "_collect_", [(function(each){return smalltalk.send(each, "_asJSON", []);})]);
  6162. return self;},
  6163. args: [],
  6164. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  6165. messageSends: ["collect:", "asArray", "asJSON"],
  6166. referencedClasses: []
  6167. }),
  6168. smalltalk.Collection);
  6169. smalltalk.addMethod(
  6170. "_asOrderedCollection",
  6171. smalltalk.method({
  6172. selector: "asOrderedCollection",
  6173. category: 'converting',
  6174. fn: function (){
  6175. var self=this;
  6176. return smalltalk.send(self, "_asArray", []);
  6177. return self;},
  6178. args: [],
  6179. source: "asOrderedCollection\x0a\x09^self asArray",
  6180. messageSends: ["asArray"],
  6181. referencedClasses: []
  6182. }),
  6183. smalltalk.Collection);
  6184. smalltalk.addMethod(
  6185. "_asSet",
  6186. smalltalk.method({
  6187. selector: "asSet",
  6188. category: 'converting',
  6189. fn: function (){
  6190. var self=this;
  6191. return smalltalk.send((smalltalk.Set || Set), "_withAll_", [self]);
  6192. return self;},
  6193. args: [],
  6194. source: "asSet\x0a\x09^Set withAll: self",
  6195. messageSends: ["withAll:"],
  6196. referencedClasses: ["Set"]
  6197. }),
  6198. smalltalk.Collection);
  6199. smalltalk.addMethod(
  6200. "_collect_",
  6201. smalltalk.method({
  6202. selector: "collect:",
  6203. category: 'enumerating',
  6204. fn: function (aBlock){
  6205. var self=this;
  6206. var newCollection=nil;
  6207. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  6208. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(newCollection, "_add_", [smalltalk.send(aBlock, "_value_", [each])]);})]);
  6209. return newCollection;
  6210. return self;},
  6211. args: ["aBlock"],
  6212. source: "collect: aBlock\x0a\x09| newCollection |\x0a\x09newCollection := self class new.\x0a\x09self do: [:each |\x0a\x09 newCollection add: (aBlock value: each)].\x0a\x09^newCollection",
  6213. messageSends: ["new", "class", "do:", "add:", "value:"],
  6214. referencedClasses: []
  6215. }),
  6216. smalltalk.Collection);
  6217. smalltalk.addMethod(
  6218. "_copyWith_",
  6219. smalltalk.method({
  6220. selector: "copyWith:",
  6221. category: 'copying',
  6222. fn: function (anObject){
  6223. var self=this;
  6224. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  6225. return self;},
  6226. args: ["anObject"],
  6227. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  6228. messageSends: ["add:", "yourself", "copy"],
  6229. referencedClasses: []
  6230. }),
  6231. smalltalk.Collection);
  6232. smalltalk.addMethod(
  6233. "_copyWithAll_",
  6234. smalltalk.method({
  6235. selector: "copyWithAll:",
  6236. category: 'copying',
  6237. fn: function (aCollection){
  6238. var self=this;
  6239. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  6240. return self;},
  6241. args: ["aCollection"],
  6242. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  6243. messageSends: ["addAll:", "yourself", "copy"],
  6244. referencedClasses: []
  6245. }),
  6246. smalltalk.Collection);
  6247. smalltalk.addMethod(
  6248. "_copyWithoutAll_",
  6249. smalltalk.method({
  6250. selector: "copyWithoutAll:",
  6251. category: 'copying',
  6252. fn: function (aCollection){
  6253. var self=this;
  6254. return smalltalk.send(self, "_reject_", [(function(each){return smalltalk.send(aCollection, "_includes_", [each]);})]);
  6255. return self;},
  6256. args: ["aCollection"],
  6257. 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]",
  6258. messageSends: ["reject:", "includes:"],
  6259. referencedClasses: []
  6260. }),
  6261. smalltalk.Collection);
  6262. smalltalk.addMethod(
  6263. "_detect_",
  6264. smalltalk.method({
  6265. selector: "detect:",
  6266. category: 'enumerating',
  6267. fn: function (aBlock){
  6268. var self=this;
  6269. return smalltalk.send(self, "_detect_ifNone_", [aBlock, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  6270. return self;},
  6271. args: ["aBlock"],
  6272. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  6273. messageSends: ["detect:ifNone:", "errorNotFound"],
  6274. referencedClasses: []
  6275. }),
  6276. smalltalk.Collection);
  6277. smalltalk.addMethod(
  6278. "_detect_ifNone_",
  6279. smalltalk.method({
  6280. selector: "detect:ifNone:",
  6281. category: 'enumerating',
  6282. fn: function (aBlock, anotherBlock){
  6283. var self=this;
  6284. for(var i = 0; i < self.length; i++)
  6285. if(aBlock(self[i]))
  6286. return self[i];
  6287. return anotherBlock();
  6288. ;
  6289. return self;},
  6290. args: ["aBlock", "anotherBlock"],
  6291. 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>",
  6292. messageSends: [],
  6293. referencedClasses: []
  6294. }),
  6295. smalltalk.Collection);
  6296. smalltalk.addMethod(
  6297. "_do_",
  6298. smalltalk.method({
  6299. selector: "do:",
  6300. category: 'enumerating',
  6301. fn: function (aBlock){
  6302. var self=this;
  6303. for(var i=0;i<self.length;i++){aBlock(self[i]);};
  6304. return self;},
  6305. args: ["aBlock"],
  6306. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  6307. messageSends: [],
  6308. referencedClasses: []
  6309. }),
  6310. smalltalk.Collection);
  6311. smalltalk.addMethod(
  6312. "_do_separatedBy_",
  6313. smalltalk.method({
  6314. selector: "do:separatedBy:",
  6315. category: 'enumerating',
  6316. fn: function (aBlock, anotherBlock){
  6317. var self=this;
  6318. var first=nil;
  6319. (first=true);
  6320. smalltalk.send(self, "_do_", [(function(each){((($receiver = first).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (first=false);})() : (function(){return smalltalk.send(anotherBlock, "_value", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (first=false);}), (function(){return smalltalk.send(anotherBlock, "_value", []);})]));return smalltalk.send(aBlock, "_value_", [each]);})]);
  6321. return self;},
  6322. args: ["aBlock", "anotherBlock"],
  6323. 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]",
  6324. messageSends: ["do:", "ifTrue:ifFalse:", "value", "value:"],
  6325. referencedClasses: []
  6326. }),
  6327. smalltalk.Collection);
  6328. smalltalk.addMethod(
  6329. "_errorNotFound",
  6330. smalltalk.method({
  6331. selector: "errorNotFound",
  6332. category: 'error handling',
  6333. fn: function (){
  6334. var self=this;
  6335. smalltalk.send(self, "_error_", ["Object is not in the collection"]);
  6336. return self;},
  6337. args: [],
  6338. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  6339. messageSends: ["error:"],
  6340. referencedClasses: []
  6341. }),
  6342. smalltalk.Collection);
  6343. smalltalk.addMethod(
  6344. "_ifEmpty_",
  6345. smalltalk.method({
  6346. selector: "ifEmpty:",
  6347. category: 'testing',
  6348. fn: function (aBlock){
  6349. var self=this;
  6350. return ((($receiver = smalltalk.send(self, "_isEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : (function(){return self;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);}), (function(){return self;})]));
  6351. return self;},
  6352. args: ["aBlock"],
  6353. 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 ]",
  6354. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"],
  6355. referencedClasses: []
  6356. }),
  6357. smalltalk.Collection);
  6358. smalltalk.addMethod(
  6359. "_ifNotEmpty_",
  6360. smalltalk.method({
  6361. selector: "ifNotEmpty:",
  6362. category: 'testing',
  6363. fn: function (aBlock){
  6364. var self=this;
  6365. smalltalk.send(smalltalk.send(self, "_notEmpty", []), "_ifTrue_", [aBlock]);
  6366. return self;},
  6367. args: ["aBlock"],
  6368. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  6369. messageSends: ["ifTrue:", "notEmpty"],
  6370. referencedClasses: []
  6371. }),
  6372. smalltalk.Collection);
  6373. smalltalk.addMethod(
  6374. "_includes_",
  6375. smalltalk.method({
  6376. selector: "includes:",
  6377. category: 'testing',
  6378. fn: function (anObject){
  6379. var self=this;
  6380. var i = self.length;
  6381. while (i--) {
  6382. if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
  6383. }
  6384. return false
  6385. ;
  6386. return self;},
  6387. args: ["anObject"],
  6388. source: "includes: anObject\x0a\x09<\x0a\x09\x09var i = self.length;\x0a\x09\x09while (i--) {\x0a\x09\x09\x09if (smalltalk.send(self[i], \x22__eq\x22, [anObject])) {return true;}\x09\x0a\x09\x09}\x0a\x09\x09return false\x0a\x09>",
  6389. messageSends: [],
  6390. referencedClasses: []
  6391. }),
  6392. smalltalk.Collection);
  6393. smalltalk.addMethod(
  6394. "_inject_into_",
  6395. smalltalk.method({
  6396. selector: "inject:into:",
  6397. category: 'enumerating',
  6398. fn: function (anObject, aBlock){
  6399. var self=this;
  6400. var result=nil;
  6401. (result=anObject);
  6402. smalltalk.send(self, "_do_", [(function(each){return (result=smalltalk.send(aBlock, "_value_value_", [result, each]));})]);
  6403. return result;
  6404. return self;},
  6405. args: ["anObject", "aBlock"],
  6406. 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",
  6407. messageSends: ["do:", "value:value:"],
  6408. referencedClasses: []
  6409. }),
  6410. smalltalk.Collection);
  6411. smalltalk.addMethod(
  6412. "_isEmpty",
  6413. smalltalk.method({
  6414. selector: "isEmpty",
  6415. category: 'testing',
  6416. fn: function (){
  6417. var self=this;
  6418. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  6419. return self;},
  6420. args: [],
  6421. source: "isEmpty\x0a\x09^self size = 0",
  6422. messageSends: ["=", "size"],
  6423. referencedClasses: []
  6424. }),
  6425. smalltalk.Collection);
  6426. smalltalk.addMethod(
  6427. "_notEmpty",
  6428. smalltalk.method({
  6429. selector: "notEmpty",
  6430. category: 'testing',
  6431. fn: function (){
  6432. var self=this;
  6433. return smalltalk.send(smalltalk.send(self, "_isEmpty", []), "_not", []);
  6434. return self;},
  6435. args: [],
  6436. source: "notEmpty\x0a\x09^self isEmpty not",
  6437. messageSends: ["not", "isEmpty"],
  6438. referencedClasses: []
  6439. }),
  6440. smalltalk.Collection);
  6441. smalltalk.addMethod(
  6442. "_readStream",
  6443. smalltalk.method({
  6444. selector: "readStream",
  6445. category: 'accessing',
  6446. fn: function (){
  6447. var self=this;
  6448. return smalltalk.send(self, "_stream", []);
  6449. return self;},
  6450. args: [],
  6451. source: "readStream\x0a\x09^self stream",
  6452. messageSends: ["stream"],
  6453. referencedClasses: []
  6454. }),
  6455. smalltalk.Collection);
  6456. smalltalk.addMethod(
  6457. "_reject_",
  6458. smalltalk.method({
  6459. selector: "reject:",
  6460. category: 'enumerating',
  6461. fn: function (aBlock){
  6462. var self=this;
  6463. return smalltalk.send(self, "_select_", [(function(each){return smalltalk.send(smalltalk.send(aBlock, "_value_", [each]), "__eq", [false]);})]);
  6464. return self;},
  6465. args: ["aBlock"],
  6466. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  6467. messageSends: ["select:", "=", "value:"],
  6468. referencedClasses: []
  6469. }),
  6470. smalltalk.Collection);
  6471. smalltalk.addMethod(
  6472. "_remove_",
  6473. smalltalk.method({
  6474. selector: "remove:",
  6475. category: 'adding/removing',
  6476. fn: function (anObject){
  6477. var self=this;
  6478. return smalltalk.send(self, "_remove_ifAbsent_", [anObject, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  6479. return self;},
  6480. args: ["anObject"],
  6481. source: "remove: anObject\x0a ^self remove: anObject ifAbsent: [self errorNotFound]",
  6482. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  6483. referencedClasses: []
  6484. }),
  6485. smalltalk.Collection);
  6486. smalltalk.addMethod(
  6487. "_remove_ifAbsent_",
  6488. smalltalk.method({
  6489. selector: "remove:ifAbsent:",
  6490. category: 'adding/removing',
  6491. fn: function (anObject, aBlock){
  6492. var self=this;
  6493. smalltalk.send(self, "_subclassResponsibility", []);
  6494. return self;},
  6495. args: ["anObject", "aBlock"],
  6496. source: "remove: anObject ifAbsent: aBlock\x0a self subclassResponsibility",
  6497. messageSends: ["subclassResponsibility"],
  6498. referencedClasses: []
  6499. }),
  6500. smalltalk.Collection);
  6501. smalltalk.addMethod(
  6502. "_select_",
  6503. smalltalk.method({
  6504. selector: "select:",
  6505. category: 'enumerating',
  6506. fn: function (aBlock){
  6507. var self=this;
  6508. var stream=nil;
  6509. (stream=smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_new", []), "_writeStream", []));
  6510. smalltalk.send(self, "_do_", [(function(each){return ((($receiver = smalltalk.send(aBlock, "_value_", [each])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(stream, "_nextPut_", [each]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(stream, "_nextPut_", [each]);})]));})]);
  6511. return smalltalk.send(stream, "_contents", []);
  6512. return self;},
  6513. args: ["aBlock"],
  6514. 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",
  6515. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  6516. referencedClasses: []
  6517. }),
  6518. smalltalk.Collection);
  6519. smalltalk.addMethod(
  6520. "_size",
  6521. smalltalk.method({
  6522. selector: "size",
  6523. category: 'accessing',
  6524. fn: function (){
  6525. var self=this;
  6526. smalltalk.send(self, "_subclassResponsibility", []);
  6527. return self;},
  6528. args: [],
  6529. source: "size\x0a\x09self subclassResponsibility",
  6530. messageSends: ["subclassResponsibility"],
  6531. referencedClasses: []
  6532. }),
  6533. smalltalk.Collection);
  6534. smalltalk.addMethod(
  6535. "_stream",
  6536. smalltalk.method({
  6537. selector: "stream",
  6538. category: 'accessing',
  6539. fn: function (){
  6540. var self=this;
  6541. return smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [self]);
  6542. return self;},
  6543. args: [],
  6544. source: "stream\x0a\x09^self streamClass on: self",
  6545. messageSends: ["on:", "streamClass"],
  6546. referencedClasses: []
  6547. }),
  6548. smalltalk.Collection);
  6549. smalltalk.addMethod(
  6550. "_streamClass",
  6551. smalltalk.method({
  6552. selector: "streamClass",
  6553. category: 'accessing',
  6554. fn: function (){
  6555. var self=this;
  6556. return smalltalk.send(smalltalk.send(self, "_class", []), "_streamClass", []);
  6557. return self;},
  6558. args: [],
  6559. source: "streamClass\x0a\x09^self class streamClass",
  6560. messageSends: ["streamClass", "class"],
  6561. referencedClasses: []
  6562. }),
  6563. smalltalk.Collection);
  6564. smalltalk.addMethod(
  6565. "_writeStream",
  6566. smalltalk.method({
  6567. selector: "writeStream",
  6568. category: 'accessing',
  6569. fn: function (){
  6570. var self=this;
  6571. return smalltalk.send(self, "_stream", []);
  6572. return self;},
  6573. args: [],
  6574. source: "writeStream\x0a\x09^self stream",
  6575. messageSends: ["stream"],
  6576. referencedClasses: []
  6577. }),
  6578. smalltalk.Collection);
  6579. smalltalk.addMethod(
  6580. "_new_",
  6581. smalltalk.method({
  6582. selector: "new:",
  6583. category: 'instance creation',
  6584. fn: function (anInteger){
  6585. var self=this;
  6586. return smalltalk.send(self, "_new", []);
  6587. return self;},
  6588. args: ["anInteger"],
  6589. source: "new: anInteger\x0a\x09^self new",
  6590. messageSends: ["new"],
  6591. referencedClasses: []
  6592. }),
  6593. smalltalk.Collection.klass);
  6594. smalltalk.addMethod(
  6595. "_streamClass",
  6596. smalltalk.method({
  6597. selector: "streamClass",
  6598. category: 'accessing',
  6599. fn: function (){
  6600. var self=this;
  6601. return (smalltalk.Stream || Stream);
  6602. return self;},
  6603. args: [],
  6604. source: "streamClass\x0a\x09 ^Stream",
  6605. messageSends: [],
  6606. referencedClasses: ["Stream"]
  6607. }),
  6608. smalltalk.Collection.klass);
  6609. smalltalk.addMethod(
  6610. "_with_",
  6611. smalltalk.method({
  6612. selector: "with:",
  6613. category: 'instance creation',
  6614. fn: function (anObject){
  6615. var self=this;
  6616. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  6617. return self;},
  6618. args: ["anObject"],
  6619. source: "with: anObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  6620. messageSends: ["add:", "yourself", "new"],
  6621. referencedClasses: []
  6622. }),
  6623. smalltalk.Collection.klass);
  6624. smalltalk.addMethod(
  6625. "_with_with_",
  6626. smalltalk.method({
  6627. selector: "with:with:",
  6628. category: 'instance creation',
  6629. fn: function (anObject, anotherObject){
  6630. var self=this;
  6631. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);smalltalk.send($rec, "_add_", [anotherObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  6632. return self;},
  6633. args: ["anObject", "anotherObject"],
  6634. source: "with: anObject with: anotherObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  6635. messageSends: ["add:", "yourself", "new"],
  6636. referencedClasses: []
  6637. }),
  6638. smalltalk.Collection.klass);
  6639. smalltalk.addMethod(
  6640. "_with_with_with_",
  6641. smalltalk.method({
  6642. selector: "with:with:with:",
  6643. category: 'instance creation',
  6644. fn: function (firstObject, secondObject, thirdObject){
  6645. var self=this;
  6646. return (function($rec){smalltalk.send($rec, "_add_", [firstObject]);smalltalk.send($rec, "_add_", [secondObject]);smalltalk.send($rec, "_add_", [thirdObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  6647. return self;},
  6648. args: ["firstObject", "secondObject", "thirdObject"],
  6649. 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",
  6650. messageSends: ["add:", "yourself", "new"],
  6651. referencedClasses: []
  6652. }),
  6653. smalltalk.Collection.klass);
  6654. smalltalk.addMethod(
  6655. "_withAll_",
  6656. smalltalk.method({
  6657. selector: "withAll:",
  6658. category: 'instance creation',
  6659. fn: function (aCollection){
  6660. var self=this;
  6661. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  6662. return self;},
  6663. args: ["aCollection"],
  6664. source: "withAll: aCollection\x0a\x09 ^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  6665. messageSends: ["addAll:", "yourself", "new"],
  6666. referencedClasses: []
  6667. }),
  6668. smalltalk.Collection.klass);
  6669. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  6670. 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."
  6671. smalltalk.addMethod(
  6672. "__comma",
  6673. smalltalk.method({
  6674. selector: ",",
  6675. category: 'copying',
  6676. fn: function (aCollection){
  6677. var self=this;
  6678. smalltalk.send(self, "_shouldNotImplement", []);
  6679. return self;},
  6680. args: ["aCollection"],
  6681. source: ", aCollection\x0a\x09self shouldNotImplement",
  6682. messageSends: ["shouldNotImplement"],
  6683. referencedClasses: []
  6684. }),
  6685. smalltalk.HashedCollection);
  6686. smalltalk.addMethod(
  6687. "__eq",
  6688. smalltalk.method({
  6689. selector: "=",
  6690. category: 'comparing',
  6691. fn: function (aHashedCollection){
  6692. var self=this;
  6693. var $early={};
  6694. try{((($receiver = smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aHashedCollection, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  6695. ((($receiver = smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [smalltalk.send(aHashedCollection, "_size", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  6696. return smalltalk.send(smalltalk.send(self, "_associations", []), "__eq", [smalltalk.send(aHashedCollection, "_associations", [])]);
  6697. return self;
  6698. } catch(e) {if(e===$early)return e[0]; throw e}},
  6699. args: ["aHashedCollection"],
  6700. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  6701. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  6702. referencedClasses: []
  6703. }),
  6704. smalltalk.HashedCollection);
  6705. smalltalk.addMethod(
  6706. "_add_",
  6707. smalltalk.method({
  6708. selector: "add:",
  6709. category: 'adding/removing',
  6710. fn: function (anAssociation){
  6711. var self=this;
  6712. smalltalk.send(self, "_at_put_", [smalltalk.send(anAssociation, "_key", []), smalltalk.send(anAssociation, "_value", [])]);
  6713. return self;},
  6714. args: ["anAssociation"],
  6715. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  6716. messageSends: ["at:put:", "key", "value"],
  6717. referencedClasses: []
  6718. }),
  6719. smalltalk.HashedCollection);
  6720. smalltalk.addMethod(
  6721. "_addAll_",
  6722. smalltalk.method({
  6723. selector: "addAll:",
  6724. category: 'adding/removing',
  6725. fn: function (aHashedCollection){
  6726. var self=this;
  6727. smalltalk.send(self, "_addAll_", [smalltalk.send(aHashedCollection, "_associations", [])], smalltalk.HashedCollection.superclass || nil);
  6728. return aHashedCollection;
  6729. return self;},
  6730. args: ["aHashedCollection"],
  6731. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  6732. messageSends: ["addAll:", "associations"],
  6733. referencedClasses: []
  6734. }),
  6735. smalltalk.HashedCollection);
  6736. smalltalk.addMethod(
  6737. "_asDictionary",
  6738. smalltalk.method({
  6739. selector: "asDictionary",
  6740. category: 'converting',
  6741. fn: function (){
  6742. var self=this;
  6743. return smalltalk.send((smalltalk.Dictionary || Dictionary), "_fromPairs_", [smalltalk.send(self, "_associations", [])]);
  6744. return self;},
  6745. args: [],
  6746. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  6747. messageSends: ["fromPairs:", "associations"],
  6748. referencedClasses: ["Dictionary"]
  6749. }),
  6750. smalltalk.HashedCollection);
  6751. smalltalk.addMethod(
  6752. "_asJSON",
  6753. smalltalk.method({
  6754. selector: "asJSON",
  6755. category: 'converting',
  6756. fn: function (){
  6757. var self=this;
  6758. var c=nil;
  6759. (c=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  6760. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(c, "_at_put_", [key, smalltalk.send(value, "_asJSON", [])]);})]);
  6761. return c;
  6762. return self;},
  6763. args: [],
  6764. 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",
  6765. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  6766. referencedClasses: []
  6767. }),
  6768. smalltalk.HashedCollection);
  6769. smalltalk.addMethod(
  6770. "_associations",
  6771. smalltalk.method({
  6772. selector: "associations",
  6773. category: 'accessing',
  6774. fn: function (){
  6775. var self=this;
  6776. var associations=nil;
  6777. (associations=[]);
  6778. smalltalk.send(smalltalk.send(self, "_keys", []), "_do_", [(function(each){return smalltalk.send(associations, "_add_", [smalltalk.send((smalltalk.Association || Association), "_key_value_", [each, smalltalk.send(self, "_at_", [each])])]);})]);
  6779. return associations;
  6780. return self;},
  6781. args: [],
  6782. 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",
  6783. messageSends: ["do:", "keys", "add:", "key:value:", "at:"],
  6784. referencedClasses: ["Association"]
  6785. }),
  6786. smalltalk.HashedCollection);
  6787. smalltalk.addMethod(
  6788. "_associationsDo_",
  6789. smalltalk.method({
  6790. selector: "associationsDo:",
  6791. category: 'enumerating',
  6792. fn: function (aBlock){
  6793. var self=this;
  6794. smalltalk.send(smalltalk.send(self, "_associations", []), "_do_", [aBlock]);
  6795. return self;},
  6796. args: ["aBlock"],
  6797. source: "associationsDo: aBlock\x0a\x09self associations do: aBlock",
  6798. messageSends: ["do:", "associations"],
  6799. referencedClasses: []
  6800. }),
  6801. smalltalk.HashedCollection);
  6802. smalltalk.addMethod(
  6803. "_at_",
  6804. smalltalk.method({
  6805. selector: "at:",
  6806. category: 'accessing',
  6807. fn: function (aKey){
  6808. var self=this;
  6809. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  6810. return self;},
  6811. args: ["aKey"],
  6812. source: "at: aKey\x0a\x09^self at: aKey ifAbsent: [self errorNotFound]",
  6813. messageSends: ["at:ifAbsent:", "errorNotFound"],
  6814. referencedClasses: []
  6815. }),
  6816. smalltalk.HashedCollection);
  6817. smalltalk.addMethod(
  6818. "_at_ifAbsent_",
  6819. smalltalk.method({
  6820. selector: "at:ifAbsent:",
  6821. category: 'accessing',
  6822. fn: function (aKey, aBlock){
  6823. var self=this;
  6824. return smalltalk.send(smalltalk.send(self, "_includesKey_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_basicAt_", [aKey]);}), aBlock]);
  6825. return self;},
  6826. args: ["aKey", "aBlock"],
  6827. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  6828. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:"],
  6829. referencedClasses: []
  6830. }),
  6831. smalltalk.HashedCollection);
  6832. smalltalk.addMethod(
  6833. "_at_ifAbsentPut_",
  6834. smalltalk.method({
  6835. selector: "at:ifAbsentPut:",
  6836. category: 'accessing',
  6837. fn: function (aKey, aBlock){
  6838. var self=this;
  6839. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_at_put_", [aKey, smalltalk.send(aBlock, "_value", [])]);})]);
  6840. return self;},
  6841. args: ["aKey", "aBlock"],
  6842. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09 self at: aKey put: aBlock value]",
  6843. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  6844. referencedClasses: []
  6845. }),
  6846. smalltalk.HashedCollection);
  6847. smalltalk.addMethod(
  6848. "_at_ifPresent_",
  6849. smalltalk.method({
  6850. selector: "at:ifPresent:",
  6851. category: 'accessing',
  6852. fn: function (aKey, aBlock){
  6853. var self=this;
  6854. return (($receiver = smalltalk.send(self, "_basicAt_", [aKey])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})() : nil;
  6855. return self;},
  6856. args: ["aKey", "aBlock"],
  6857. source: "at: aKey ifPresent: aBlock\x0a\x09^(self basicAt: aKey) ifNotNil: [aBlock value: (self at: aKey)]",
  6858. messageSends: ["ifNotNil:", "basicAt:", "value:", "at:"],
  6859. referencedClasses: []
  6860. }),
  6861. smalltalk.HashedCollection);
  6862. smalltalk.addMethod(
  6863. "_at_ifPresent_ifAbsent_",
  6864. smalltalk.method({
  6865. selector: "at:ifPresent:ifAbsent:",
  6866. category: 'accessing',
  6867. fn: function (aKey, aBlock, anotherBlock){
  6868. var self=this;
  6869. return smalltalk.send(smalltalk.send(self, "_basicAt_", [aKey]), "_ifNil_ifNotNil_", [anotherBlock, (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})]);
  6870. return self;},
  6871. args: ["aKey", "aBlock", "anotherBlock"],
  6872. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09^(self basicAt: aKey)\x0a\x09 ifNil: anotherBlock\x0a\x09 ifNotNil: [aBlock value: (self at: aKey)]",
  6873. messageSends: ["ifNil:ifNotNil:", "basicAt:", "value:", "at:"],
  6874. referencedClasses: []
  6875. }),
  6876. smalltalk.HashedCollection);
  6877. smalltalk.addMethod(
  6878. "_at_put_",
  6879. smalltalk.method({
  6880. selector: "at:put:",
  6881. category: 'accessing',
  6882. fn: function (aKey, aValue){
  6883. var self=this;
  6884. return smalltalk.send(self, "_basicAt_put_", [aKey, aValue]);
  6885. return self;},
  6886. args: ["aKey", "aValue"],
  6887. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  6888. messageSends: ["basicAt:put:"],
  6889. referencedClasses: []
  6890. }),
  6891. smalltalk.HashedCollection);
  6892. smalltalk.addMethod(
  6893. "_collect_",
  6894. smalltalk.method({
  6895. selector: "collect:",
  6896. category: 'enumerating',
  6897. fn: function (aBlock){
  6898. var self=this;
  6899. var newDict=nil;
  6900. (newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  6901. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(newDict, "_at_put_", [key, smalltalk.send(aBlock, "_value_", [value])]);})]);
  6902. return newDict;
  6903. return self;},
  6904. args: ["aBlock"],
  6905. 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",
  6906. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  6907. referencedClasses: []
  6908. }),
  6909. smalltalk.HashedCollection);
  6910. smalltalk.addMethod(
  6911. "_copyFrom_to_",
  6912. smalltalk.method({
  6913. selector: "copyFrom:to:",
  6914. category: 'copying',
  6915. fn: function (anIndex, anotherIndex){
  6916. var self=this;
  6917. smalltalk.send(self, "_shouldNotImplement", []);
  6918. return self;},
  6919. args: ["anIndex", "anotherIndex"],
  6920. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self shouldNotImplement",
  6921. messageSends: ["shouldNotImplement"],
  6922. referencedClasses: []
  6923. }),
  6924. smalltalk.HashedCollection);
  6925. smalltalk.addMethod(
  6926. "_deepCopy",
  6927. smalltalk.method({
  6928. selector: "deepCopy",
  6929. category: 'copying',
  6930. fn: function (){
  6931. var self=this;
  6932. var copy=nil;
  6933. (copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  6934. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(smalltalk.send(each, "_value", []), "_deepCopy", [])]);})]);
  6935. return copy;
  6936. return self;},
  6937. args: [],
  6938. 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",
  6939. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "deepCopy", "value"],
  6940. referencedClasses: []
  6941. }),
  6942. smalltalk.HashedCollection);
  6943. smalltalk.addMethod(
  6944. "_detect_ifNone_",
  6945. smalltalk.method({
  6946. selector: "detect:ifNone:",
  6947. category: 'enumerating',
  6948. fn: function (aBlock, anotherBlock){
  6949. var self=this;
  6950. return smalltalk.send(smalltalk.send(self, "_values", []), "_detect_ifNone_", [aBlock, anotherBlock]);
  6951. return self;},
  6952. args: ["aBlock", "anotherBlock"],
  6953. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  6954. messageSends: ["detect:ifNone:", "values"],
  6955. referencedClasses: []
  6956. }),
  6957. smalltalk.HashedCollection);
  6958. smalltalk.addMethod(
  6959. "_do_",
  6960. smalltalk.method({
  6961. selector: "do:",
  6962. category: 'enumerating',
  6963. fn: function (aBlock){
  6964. var self=this;
  6965. smalltalk.send(smalltalk.send(self, "_values", []), "_do_", [aBlock]);
  6966. return self;},
  6967. args: ["aBlock"],
  6968. source: "do: aBlock\x0a\x09self values do: aBlock",
  6969. messageSends: ["do:", "values"],
  6970. referencedClasses: []
  6971. }),
  6972. smalltalk.HashedCollection);
  6973. smalltalk.addMethod(
  6974. "_includes_",
  6975. smalltalk.method({
  6976. selector: "includes:",
  6977. category: 'enumerating',
  6978. fn: function (anObject){
  6979. var self=this;
  6980. return smalltalk.send(smalltalk.send(self, "_values", []), "_includes_", [anObject]);
  6981. return self;},
  6982. args: ["anObject"],
  6983. source: "includes: anObject\x0a\x09^self values includes: anObject",
  6984. messageSends: ["includes:", "values"],
  6985. referencedClasses: []
  6986. }),
  6987. smalltalk.HashedCollection);
  6988. smalltalk.addMethod(
  6989. "_includesKey_",
  6990. smalltalk.method({
  6991. selector: "includesKey:",
  6992. category: 'testing',
  6993. fn: function (aKey){
  6994. var self=this;
  6995. return self.hasOwnProperty(aKey);
  6996. return self;},
  6997. args: ["aKey"],
  6998. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  6999. messageSends: [],
  7000. referencedClasses: []
  7001. }),
  7002. smalltalk.HashedCollection);
  7003. smalltalk.addMethod(
  7004. "_keys",
  7005. smalltalk.method({
  7006. selector: "keys",
  7007. category: 'accessing',
  7008. fn: function (){
  7009. var self=this;
  7010. if ('function'===typeof Object.keys) return Object.keys(self);
  7011. var keys = [];
  7012. for(var i in self) {
  7013. if(self.hasOwnProperty(i)) {
  7014. keys.push(i);
  7015. }
  7016. };
  7017. return keys;
  7018. ;
  7019. return self;},
  7020. args: [],
  7021. 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>",
  7022. messageSends: [],
  7023. referencedClasses: []
  7024. }),
  7025. smalltalk.HashedCollection);
  7026. smalltalk.addMethod(
  7027. "_keysAndValuesDo_",
  7028. smalltalk.method({
  7029. selector: "keysAndValuesDo:",
  7030. category: 'enumerating',
  7031. fn: function (aBlock){
  7032. var self=this;
  7033. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(aBlock, "_value_value_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  7034. return self;},
  7035. args: ["aBlock"],
  7036. source: "keysAndValuesDo: aBlock\x0a\x09self associationsDo: [:each |\x0a\x09 aBlock value: each key value: each value]",
  7037. messageSends: ["associationsDo:", "value:value:", "key", "value"],
  7038. referencedClasses: []
  7039. }),
  7040. smalltalk.HashedCollection);
  7041. smalltalk.addMethod(
  7042. "_printString",
  7043. smalltalk.method({
  7044. selector: "printString",
  7045. category: 'printing',
  7046. fn: function (){
  7047. var self=this;
  7048. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.HashedCollection.superclass || nil)]);return smalltalk.send($rec, "_nextPutAll_", ["("]);})(aStream);smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(anAssociation){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(anAssociation, "_key", []), "_printString", [])]);smalltalk.send($rec, "_nextPutAll_", [" -> "]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(anAssociation, "_value", []), "_printString", [])]);})(aStream);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [" , "]);})]);return smalltalk.send(aStream, "_nextPutAll_", [")"]);})]);
  7049. return self;},
  7050. args: [],
  7051. source: "printString\x0a\x09^String streamContents: [:aStream| \x0a\x09\x09aStream \x0a\x09\x09\x09nextPutAll: super printString;\x0a\x09\x09\x09nextPutAll: '('.\x0a\x09\x09\x09\x09self associations \x0a\x09\x09\x09\x09\x09do: [:anAssociation| \x0a\x09\x09\x09\x09\x09\x09aStream \x0a\x09\x09\x09\x09\x09\x09\x09nextPutAll: anAssociation key printString;\x0a\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: ' -> ';\x0a\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: anAssociation value printString]\x0a\x09\x09\x09\x09\x09\x09\x09separatedBy: [aStream nextPutAll: ' , '].\x0a\x09\x09\x09\x09\x09\x09aStream nextPutAll: ')']",
  7052. messageSends: ["streamContents:", "nextPutAll:", "printString", "do:separatedBy:", "associations", "key", "value"],
  7053. referencedClasses: ["String"]
  7054. }),
  7055. smalltalk.HashedCollection);
  7056. smalltalk.addMethod(
  7057. "_remove_ifAbsent_",
  7058. smalltalk.method({
  7059. selector: "remove:ifAbsent:",
  7060. category: 'adding/removing',
  7061. fn: function (aKey, aBlock){
  7062. var self=this;
  7063. return smalltalk.send(self, "_removeKey_ifAbsent_", [aKey, aBlock]);
  7064. return self;},
  7065. args: ["aKey", "aBlock"],
  7066. source: "remove: aKey ifAbsent: aBlock\x0a ^self removeKey: aKey ifAbsent: aBlock",
  7067. messageSends: ["removeKey:ifAbsent:"],
  7068. referencedClasses: []
  7069. }),
  7070. smalltalk.HashedCollection);
  7071. smalltalk.addMethod(
  7072. "_removeKey_",
  7073. smalltalk.method({
  7074. selector: "removeKey:",
  7075. category: 'adding/removing',
  7076. fn: function (aKey){
  7077. var self=this;
  7078. return smalltalk.send(self, "_remove_", [aKey]);
  7079. return self;},
  7080. args: ["aKey"],
  7081. source: "removeKey: aKey\x0a ^self remove: aKey",
  7082. messageSends: ["remove:"],
  7083. referencedClasses: []
  7084. }),
  7085. smalltalk.HashedCollection);
  7086. smalltalk.addMethod(
  7087. "_removeKey_ifAbsent_",
  7088. smalltalk.method({
  7089. selector: "removeKey:ifAbsent:",
  7090. category: 'adding/removing',
  7091. fn: function (aKey, aBlock){
  7092. var self=this;
  7093. return ((($receiver = smalltalk.send(self, "_includesKey_", [aKey])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : (function(){return smalltalk.send(self, "_basicDelete_", [aKey]);})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return smalltalk.send(aBlock, "_value", []);}), (function(){return smalltalk.send(self, "_basicDelete_", [aKey]);})]));
  7094. return self;},
  7095. args: ["aKey", "aBlock"],
  7096. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey) \x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  7097. messageSends: ["ifFalse:ifTrue:", "includesKey:", "value", "basicDelete:"],
  7098. referencedClasses: []
  7099. }),
  7100. smalltalk.HashedCollection);
  7101. smalltalk.addMethod(
  7102. "_select_",
  7103. smalltalk.method({
  7104. selector: "select:",
  7105. category: 'enumerating',
  7106. fn: function (aBlock){
  7107. var self=this;
  7108. var newDict=nil;
  7109. (newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  7110. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return ((($receiver = smalltalk.send(aBlock, "_value_", [value])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(newDict, "_at_put_", [key, value]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(newDict, "_at_put_", [key, value]);})]));})]);
  7111. return newDict;
  7112. return self;},
  7113. args: ["aBlock"],
  7114. 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",
  7115. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"],
  7116. referencedClasses: []
  7117. }),
  7118. smalltalk.HashedCollection);
  7119. smalltalk.addMethod(
  7120. "_shallowCopy",
  7121. smalltalk.method({
  7122. selector: "shallowCopy",
  7123. category: 'copying',
  7124. fn: function (){
  7125. var self=this;
  7126. var copy=nil;
  7127. (copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  7128. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  7129. return copy;
  7130. return self;},
  7131. args: [],
  7132. 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",
  7133. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "value"],
  7134. referencedClasses: []
  7135. }),
  7136. smalltalk.HashedCollection);
  7137. smalltalk.addMethod(
  7138. "_size",
  7139. smalltalk.method({
  7140. selector: "size",
  7141. category: 'accessing',
  7142. fn: function (){
  7143. var self=this;
  7144. return smalltalk.send(smalltalk.send(self, "_keys", []), "_size", []);
  7145. return self;},
  7146. args: [],
  7147. source: "size\x0a\x09^self keys size",
  7148. messageSends: ["size", "keys"],
  7149. referencedClasses: []
  7150. }),
  7151. smalltalk.HashedCollection);
  7152. smalltalk.addMethod(
  7153. "_storeOn_",
  7154. smalltalk.method({
  7155. selector: "storeOn:",
  7156. category: 'printing',
  7157. fn: function (aStream){
  7158. var self=this;
  7159. smalltalk.send(aStream, "_nextPutAll_", ["#{"]);
  7160. smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(each){return smalltalk.send(each, "_storeOn_", [aStream]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [". "]);})]);
  7161. smalltalk.send(aStream, "_nextPutAll_", ["}"]);
  7162. return self;},
  7163. args: ["aStream"],
  7164. source: "storeOn: aStream\x0a\x09aStream nextPutAll: '#{'.\x0a\x09self associations\x0a\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09separatedBy: [ aStream nextPutAll: '. '].\x0a\x09aStream nextPutAll: '}'",
  7165. messageSends: ["nextPutAll:", "do:separatedBy:", "associations", "storeOn:"],
  7166. referencedClasses: []
  7167. }),
  7168. smalltalk.HashedCollection);
  7169. smalltalk.addMethod(
  7170. "_values",
  7171. smalltalk.method({
  7172. selector: "values",
  7173. category: 'accessing',
  7174. fn: function (){
  7175. var self=this;
  7176. return smalltalk.send(smalltalk.send(self, "_keys", []), "_collect_", [(function(each){return smalltalk.send(self, "_at_", [each]);})]);
  7177. return self;},
  7178. args: [],
  7179. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  7180. messageSends: ["collect:", "keys", "at:"],
  7181. referencedClasses: []
  7182. }),
  7183. smalltalk.HashedCollection);
  7184. smalltalk.addMethod(
  7185. "_fromPairs_",
  7186. smalltalk.method({
  7187. selector: "fromPairs:",
  7188. category: 'instance creation',
  7189. fn: function (aCollection){
  7190. var self=this;
  7191. var dict=nil;
  7192. (dict=smalltalk.send(self, "_new", []));
  7193. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(dict, "_add_", [each]);})]);
  7194. return dict;
  7195. return self;},
  7196. args: ["aCollection"],
  7197. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  7198. messageSends: ["new", "do:", "add:"],
  7199. referencedClasses: []
  7200. }),
  7201. smalltalk.HashedCollection.klass);
  7202. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  7203. smalltalk.addMethod(
  7204. "_asHashedCollection",
  7205. smalltalk.method({
  7206. selector: "asHashedCollection",
  7207. category: 'converting',
  7208. fn: function (){
  7209. var self=this;
  7210. return smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_fromPairs_", [smalltalk.send(self, "_associations", [])]);
  7211. return self;},
  7212. args: [],
  7213. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  7214. messageSends: ["fromPairs:", "associations"],
  7215. referencedClasses: ["HashedCollection"]
  7216. }),
  7217. smalltalk.Dictionary);
  7218. smalltalk.addMethod(
  7219. "_asJSON",
  7220. smalltalk.method({
  7221. selector: "asJSON",
  7222. category: 'converting',
  7223. fn: function (){
  7224. var self=this;
  7225. return smalltalk.send(smalltalk.send(self, "_asHashedCollection", []), "_asJSON", []);
  7226. return self;},
  7227. args: [],
  7228. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  7229. messageSends: ["asJSON", "asHashedCollection"],
  7230. referencedClasses: []
  7231. }),
  7232. smalltalk.Dictionary);
  7233. smalltalk.addMethod(
  7234. "_at_ifAbsent_",
  7235. smalltalk.method({
  7236. selector: "at:ifAbsent:",
  7237. category: 'accessing',
  7238. fn: function (aKey, aBlock){
  7239. var self=this;
  7240. var index;
  7241. for(var i=0;i<self['@keys'].length;i++){
  7242. if(self['@keys'][i].__eq(aKey)) {index = i;}
  7243. };
  7244. if(typeof index === 'undefined') {
  7245. return aBlock();
  7246. } else {
  7247. return self['@values'][index];
  7248. }
  7249. ;
  7250. return self;},
  7251. args: ["aKey", "aBlock"],
  7252. 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>",
  7253. messageSends: [],
  7254. referencedClasses: []
  7255. }),
  7256. smalltalk.Dictionary);
  7257. smalltalk.addMethod(
  7258. "_at_put_",
  7259. smalltalk.method({
  7260. selector: "at:put:",
  7261. category: 'accessing',
  7262. fn: function (aKey, aValue){
  7263. var self=this;
  7264. var index = self['@keys'].indexOf(aKey);
  7265. if(index === -1) {
  7266. self['@values'].push(aValue);
  7267. self['@keys'].push(aKey);
  7268. } else {
  7269. self['@values'][index] = aValue;
  7270. };
  7271. return aValue;
  7272. ;
  7273. return self;},
  7274. args: ["aKey", "aValue"],
  7275. 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>",
  7276. messageSends: [],
  7277. referencedClasses: []
  7278. }),
  7279. smalltalk.Dictionary);
  7280. smalltalk.addMethod(
  7281. "_includesKey_",
  7282. smalltalk.method({
  7283. selector: "includesKey:",
  7284. category: 'testing',
  7285. fn: function (aKey){
  7286. var self=this;
  7287. return smalltalk.send(self['@keys'], "_includes_", [aKey]);
  7288. return self;},
  7289. args: ["aKey"],
  7290. source: "includesKey: aKey\x0a\x09^keys includes: aKey",
  7291. messageSends: ["includes:"],
  7292. referencedClasses: []
  7293. }),
  7294. smalltalk.Dictionary);
  7295. smalltalk.addMethod(
  7296. "_initialize",
  7297. smalltalk.method({
  7298. selector: "initialize",
  7299. category: 'initialization',
  7300. fn: function (){
  7301. var self=this;
  7302. smalltalk.send(self, "_initialize", [], smalltalk.Dictionary.superclass || nil);
  7303. (self['@keys']=[]);
  7304. (self['@values']=[]);
  7305. return self;},
  7306. args: [],
  7307. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  7308. messageSends: ["initialize"],
  7309. referencedClasses: []
  7310. }),
  7311. smalltalk.Dictionary);
  7312. smalltalk.addMethod(
  7313. "_keys",
  7314. smalltalk.method({
  7315. selector: "keys",
  7316. category: 'accessing',
  7317. fn: function (){
  7318. var self=this;
  7319. return smalltalk.send(self['@keys'], "_copy", []);
  7320. return self;},
  7321. args: [],
  7322. source: "keys\x0a\x09^keys copy",
  7323. messageSends: ["copy"],
  7324. referencedClasses: []
  7325. }),
  7326. smalltalk.Dictionary);
  7327. smalltalk.addMethod(
  7328. "_removeKey_ifAbsent_",
  7329. smalltalk.method({
  7330. selector: "removeKey:ifAbsent:",
  7331. category: 'adding/removing',
  7332. fn: function (aKey, aBlock){
  7333. var self=this;
  7334. var index = self['@keys'].indexOf(aKey);
  7335. if(index === -1) {
  7336. return aBlock()
  7337. } else {
  7338. var value;
  7339. self['@keys'].splice(index, 1);
  7340. value = self['@values'].splice(index, 1);
  7341. return value[0];
  7342. };
  7343. ;
  7344. return self;},
  7345. args: ["aKey", "aBlock"],
  7346. 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 >",
  7347. messageSends: [],
  7348. referencedClasses: []
  7349. }),
  7350. smalltalk.Dictionary);
  7351. smalltalk.addMethod(
  7352. "_values",
  7353. smalltalk.method({
  7354. selector: "values",
  7355. category: 'accessing',
  7356. fn: function (){
  7357. var self=this;
  7358. return smalltalk.send(self['@values'], "_copy", []);
  7359. return self;},
  7360. args: [],
  7361. source: "values\x0a\x09^values copy",
  7362. messageSends: ["copy"],
  7363. referencedClasses: []
  7364. }),
  7365. smalltalk.Dictionary);
  7366. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  7367. smalltalk.addMethod(
  7368. "__eq",
  7369. smalltalk.method({
  7370. selector: "=",
  7371. category: 'comparing',
  7372. fn: function (aCollection){
  7373. var self=this;
  7374. var $early={};
  7375. try{((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aCollection, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [smalltalk.send(aCollection, "_size", [])]);})])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  7376. smalltalk.send(self, "_withIndexDo_", [(function(each, i){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_at_", [i]), "__eq", [each])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));})]);
  7377. return true;
  7378. return self;
  7379. } catch(e) {if(e===$early)return e[0]; throw e}},
  7380. args: ["aCollection"],
  7381. 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",
  7382. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"],
  7383. referencedClasses: []
  7384. }),
  7385. smalltalk.SequenceableCollection);
  7386. smalltalk.addMethod(
  7387. "_addLast_",
  7388. smalltalk.method({
  7389. selector: "addLast:",
  7390. category: 'adding',
  7391. fn: function (anObject){
  7392. var self=this;
  7393. smalltalk.send(self, "_add_", [anObject]);
  7394. return self;},
  7395. args: ["anObject"],
  7396. source: "addLast: anObject\x0a\x09self add: anObject",
  7397. messageSends: ["add:"],
  7398. referencedClasses: []
  7399. }),
  7400. smalltalk.SequenceableCollection);
  7401. smalltalk.addMethod(
  7402. "_allButFirst",
  7403. smalltalk.method({
  7404. selector: "allButFirst",
  7405. category: 'accessing',
  7406. fn: function (){
  7407. var self=this;
  7408. return smalltalk.send(self, "_copyFrom_to_", [(2), smalltalk.send(self, "_size", [])]);
  7409. return self;},
  7410. args: [],
  7411. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  7412. messageSends: ["copyFrom:to:", "size"],
  7413. referencedClasses: []
  7414. }),
  7415. smalltalk.SequenceableCollection);
  7416. smalltalk.addMethod(
  7417. "_allButLast",
  7418. smalltalk.method({
  7419. selector: "allButLast",
  7420. category: 'accessing',
  7421. fn: function (){
  7422. var self=this;
  7423. return smalltalk.send(self, "_copyFrom_to_", [(1), ((($receiver = smalltalk.send(self, "_size", [])).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]))]);
  7424. return self;},
  7425. args: [],
  7426. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  7427. messageSends: ["copyFrom:to:", "-", "size"],
  7428. referencedClasses: []
  7429. }),
  7430. smalltalk.SequenceableCollection);
  7431. smalltalk.addMethod(
  7432. "_at_",
  7433. smalltalk.method({
  7434. selector: "at:",
  7435. category: 'accessing',
  7436. fn: function (anIndex){
  7437. var self=this;
  7438. return smalltalk.send(self, "_at_ifAbsent_", [anIndex, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  7439. return self;},
  7440. args: ["anIndex"],
  7441. source: "at: anIndex\x0a\x09^self at: anIndex ifAbsent: [\x0a\x09 self errorNotFound]",
  7442. messageSends: ["at:ifAbsent:", "errorNotFound"],
  7443. referencedClasses: []
  7444. }),
  7445. smalltalk.SequenceableCollection);
  7446. smalltalk.addMethod(
  7447. "_at_ifAbsent_",
  7448. smalltalk.method({
  7449. selector: "at:ifAbsent:",
  7450. category: 'accessing',
  7451. fn: function (anIndex, aBlock){
  7452. var self=this;
  7453. smalltalk.send(self, "_subclassResponsibility", []);
  7454. return self;},
  7455. args: ["anIndex", "aBlock"],
  7456. source: "at: anIndex ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  7457. messageSends: ["subclassResponsibility"],
  7458. referencedClasses: []
  7459. }),
  7460. smalltalk.SequenceableCollection);
  7461. smalltalk.addMethod(
  7462. "_at_put_",
  7463. smalltalk.method({
  7464. selector: "at:put:",
  7465. category: 'accessing',
  7466. fn: function (anIndex, anObject){
  7467. var self=this;
  7468. smalltalk.send(self, "_subclassResponsibility", []);
  7469. return self;},
  7470. args: ["anIndex", "anObject"],
  7471. source: "at: anIndex put: anObject\x0a\x09self subclassResponsibility",
  7472. messageSends: ["subclassResponsibility"],
  7473. referencedClasses: []
  7474. }),
  7475. smalltalk.SequenceableCollection);
  7476. smalltalk.addMethod(
  7477. "_atRandom",
  7478. smalltalk.method({
  7479. selector: "atRandom",
  7480. category: 'accessing',
  7481. fn: function (){
  7482. var self=this;
  7483. return smalltalk.send(self, "_at_", [smalltalk.send(smalltalk.send(self, "_size", []), "_atRandom", [])]);
  7484. return self;},
  7485. args: [],
  7486. source: "atRandom\x0a\x09^ self at: self size atRandom",
  7487. messageSends: ["at:", "atRandom", "size"],
  7488. referencedClasses: []
  7489. }),
  7490. smalltalk.SequenceableCollection);
  7491. smalltalk.addMethod(
  7492. "_copyFrom_to_",
  7493. smalltalk.method({
  7494. selector: "copyFrom:to:",
  7495. category: 'copying',
  7496. fn: function (anIndex, anotherIndex){
  7497. var self=this;
  7498. var range=nil;
  7499. var newCollection=nil;
  7500. (range=smalltalk.send(anIndex, "_to_", [anotherIndex]));
  7501. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(range, "_size", [])]));
  7502. smalltalk.send(range, "_withIndexDo_", [(function(each, i){return smalltalk.send(newCollection, "_at_put_", [i, smalltalk.send(self, "_at_", [each])]);})]);
  7503. return newCollection;
  7504. return self;},
  7505. args: ["anIndex", "anotherIndex"],
  7506. 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",
  7507. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"],
  7508. referencedClasses: []
  7509. }),
  7510. smalltalk.SequenceableCollection);
  7511. smalltalk.addMethod(
  7512. "_deepCopy",
  7513. smalltalk.method({
  7514. selector: "deepCopy",
  7515. category: 'copying',
  7516. fn: function (){
  7517. var self=this;
  7518. var newCollection=nil;
  7519. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(self, "_size", [])]));
  7520. smalltalk.send(self, "_withIndexDo_", [(function(each, index){return smalltalk.send(newCollection, "_at_put_", [index, smalltalk.send(each, "_deepCopy", [])]);})]);
  7521. return newCollection;
  7522. return self;},
  7523. args: [],
  7524. 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",
  7525. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"],
  7526. referencedClasses: []
  7527. }),
  7528. smalltalk.SequenceableCollection);
  7529. smalltalk.addMethod(
  7530. "_first",
  7531. smalltalk.method({
  7532. selector: "first",
  7533. category: 'accessing',
  7534. fn: function (){
  7535. var self=this;
  7536. return smalltalk.send(self, "_at_", [(1)]);
  7537. return self;},
  7538. args: [],
  7539. source: "first\x0a\x09^self at: 1",
  7540. messageSends: ["at:"],
  7541. referencedClasses: []
  7542. }),
  7543. smalltalk.SequenceableCollection);
  7544. smalltalk.addMethod(
  7545. "_first_",
  7546. smalltalk.method({
  7547. selector: "first:",
  7548. category: 'accessing',
  7549. fn: function (n){
  7550. var self=this;
  7551. return smalltalk.send(self, "_copyFrom_to_", [(1), n]);
  7552. return self;},
  7553. args: ["n"],
  7554. 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",
  7555. messageSends: ["copyFrom:to:"],
  7556. referencedClasses: []
  7557. }),
  7558. smalltalk.SequenceableCollection);
  7559. smalltalk.addMethod(
  7560. "_fourth",
  7561. smalltalk.method({
  7562. selector: "fourth",
  7563. category: 'accessing',
  7564. fn: function (){
  7565. var self=this;
  7566. return smalltalk.send(self, "_at_", [(4)]);
  7567. return self;},
  7568. args: [],
  7569. source: "fourth\x0a\x09^self at: 4",
  7570. messageSends: ["at:"],
  7571. referencedClasses: []
  7572. }),
  7573. smalltalk.SequenceableCollection);
  7574. smalltalk.addMethod(
  7575. "_indexOf_",
  7576. smalltalk.method({
  7577. selector: "indexOf:",
  7578. category: 'accessing',
  7579. fn: function (anObject){
  7580. var self=this;
  7581. return smalltalk.send(self, "_indexOf_ifAbsent_", [anObject, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  7582. return self;},
  7583. args: ["anObject"],
  7584. source: "indexOf: anObject\x0a\x09^self indexOf: anObject ifAbsent: [self errorNotFound]",
  7585. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  7586. referencedClasses: []
  7587. }),
  7588. smalltalk.SequenceableCollection);
  7589. smalltalk.addMethod(
  7590. "_indexOf_ifAbsent_",
  7591. smalltalk.method({
  7592. selector: "indexOf:ifAbsent:",
  7593. category: 'accessing',
  7594. fn: function (anObject, aBlock){
  7595. var self=this;
  7596. for(var i=0;i<self.length;i++){
  7597. if(self[i].__eq(anObject)) {return i+1}
  7598. }
  7599. return aBlock();
  7600. ;
  7601. return self;},
  7602. args: ["anObject", "aBlock"],
  7603. 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>",
  7604. messageSends: [],
  7605. referencedClasses: []
  7606. }),
  7607. smalltalk.SequenceableCollection);
  7608. smalltalk.addMethod(
  7609. "_indexOf_startingAt_",
  7610. smalltalk.method({
  7611. selector: "indexOf:startingAt:",
  7612. category: 'accessing',
  7613. fn: function (anObject, start){
  7614. var self=this;
  7615. return smalltalk.send(self, "_indexOf_startingAt_ifAbsent_", [anObject, start, (function(){return (0);})]);
  7616. return self;},
  7617. args: ["anObject", "start"],
  7618. 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]",
  7619. messageSends: ["indexOf:startingAt:ifAbsent:"],
  7620. referencedClasses: []
  7621. }),
  7622. smalltalk.SequenceableCollection);
  7623. smalltalk.addMethod(
  7624. "_indexOf_startingAt_ifAbsent_",
  7625. smalltalk.method({
  7626. selector: "indexOf:startingAt:ifAbsent:",
  7627. category: 'accessing',
  7628. fn: function (anObject, start, aBlock){
  7629. var self=this;
  7630. for(var i=start-1;i<self.length;i++){
  7631. if(self[i].__eq(anObject)) {return i+1}
  7632. }
  7633. return aBlock();
  7634. ;
  7635. return self;},
  7636. args: ["anObject", "start", "aBlock"],
  7637. 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>",
  7638. messageSends: [],
  7639. referencedClasses: []
  7640. }),
  7641. smalltalk.SequenceableCollection);
  7642. smalltalk.addMethod(
  7643. "_last",
  7644. smalltalk.method({
  7645. selector: "last",
  7646. category: 'accessing',
  7647. fn: function (){
  7648. var self=this;
  7649. return smalltalk.send(self, "_at_", [smalltalk.send(self, "_size", [])]);
  7650. return self;},
  7651. args: [],
  7652. source: "last\x0a\x09^self at: self size",
  7653. messageSends: ["at:", "size"],
  7654. referencedClasses: []
  7655. }),
  7656. smalltalk.SequenceableCollection);
  7657. smalltalk.addMethod(
  7658. "_printString",
  7659. smalltalk.method({
  7660. selector: "printString",
  7661. category: 'printing',
  7662. fn: function (){
  7663. var self=this;
  7664. var str=nil;
  7665. (str=smalltalk.send("", "_writeStream", []));
  7666. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.SequenceableCollection.superclass || nil), "__comma", [" ("])]);
  7667. smalltalk.send(self, "_do_separatedBy_", [(function(each){return smalltalk.send(str, "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(str, "_nextPutAll_", [" "]);})]);
  7668. smalltalk.send(str, "_nextPutAll_", [")"]);
  7669. return smalltalk.send(str, "_contents", []);
  7670. return self;},
  7671. args: [],
  7672. source: "printString\x0a\x09| str |\x0a\x09str := '' writeStream.\x0a\x09str nextPutAll: super printString, ' ('.\x0a\x09self \x0a\x09\x09do: [:each | str nextPutAll: each printString]\x0a\x09\x09separatedBy: [str nextPutAll: ' '].\x0a\x09str nextPutAll: ')'.\x0a\x09^str contents",
  7673. messageSends: ["writeStream", "nextPutAll:", ",", "printString", "do:separatedBy:", "contents"],
  7674. referencedClasses: []
  7675. }),
  7676. smalltalk.SequenceableCollection);
  7677. smalltalk.addMethod(
  7678. "_removeLast",
  7679. smalltalk.method({
  7680. selector: "removeLast",
  7681. category: 'adding',
  7682. fn: function (){
  7683. var self=this;
  7684. smalltalk.send(self, "_remove_", [smalltalk.send(self, "_last", [])]);
  7685. return self;},
  7686. args: [],
  7687. source: "removeLast\x0a\x09self remove: self last",
  7688. messageSends: ["remove:", "last"],
  7689. referencedClasses: []
  7690. }),
  7691. smalltalk.SequenceableCollection);
  7692. smalltalk.addMethod(
  7693. "_reversed",
  7694. smalltalk.method({
  7695. selector: "reversed",
  7696. category: 'converting',
  7697. fn: function (){
  7698. var self=this;
  7699. smalltalk.send(self, "_subclassResponsibility", []);
  7700. return self;},
  7701. args: [],
  7702. source: "reversed\x0a\x09self subclassResponsibility",
  7703. messageSends: ["subclassResponsibility"],
  7704. referencedClasses: []
  7705. }),
  7706. smalltalk.SequenceableCollection);
  7707. smalltalk.addMethod(
  7708. "_second",
  7709. smalltalk.method({
  7710. selector: "second",
  7711. category: 'accessing',
  7712. fn: function (){
  7713. var self=this;
  7714. return smalltalk.send(self, "_at_", [(2)]);
  7715. return self;},
  7716. args: [],
  7717. source: "second\x0a\x09^self at: 2",
  7718. messageSends: ["at:"],
  7719. referencedClasses: []
  7720. }),
  7721. smalltalk.SequenceableCollection);
  7722. smalltalk.addMethod(
  7723. "_shallowCopy",
  7724. smalltalk.method({
  7725. selector: "shallowCopy",
  7726. category: 'copying',
  7727. fn: function (){
  7728. var self=this;
  7729. var newCollection=nil;
  7730. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(self, "_size", [])]));
  7731. smalltalk.send(self, "_withIndexDo_", [(function(each, index){return smalltalk.send(newCollection, "_at_put_", [index, each]);})]);
  7732. return newCollection;
  7733. return self;},
  7734. args: [],
  7735. 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",
  7736. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"],
  7737. referencedClasses: []
  7738. }),
  7739. smalltalk.SequenceableCollection);
  7740. smalltalk.addMethod(
  7741. "_third",
  7742. smalltalk.method({
  7743. selector: "third",
  7744. category: 'accessing',
  7745. fn: function (){
  7746. var self=this;
  7747. return smalltalk.send(self, "_at_", [(3)]);
  7748. return self;},
  7749. args: [],
  7750. source: "third\x0a\x09^self at: 3",
  7751. messageSends: ["at:"],
  7752. referencedClasses: []
  7753. }),
  7754. smalltalk.SequenceableCollection);
  7755. smalltalk.addMethod(
  7756. "_withIndexDo_",
  7757. smalltalk.method({
  7758. selector: "withIndexDo:",
  7759. category: 'enumerating',
  7760. fn: function (aBlock){
  7761. var self=this;
  7762. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  7763. return self;},
  7764. args: ["aBlock"],
  7765. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  7766. messageSends: [],
  7767. referencedClasses: []
  7768. }),
  7769. smalltalk.SequenceableCollection);
  7770. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  7771. smalltalk.addMethod(
  7772. "_add_",
  7773. smalltalk.method({
  7774. selector: "add:",
  7775. category: 'adding/removing',
  7776. fn: function (anObject){
  7777. var self=this;
  7778. self.push(anObject); return anObject;;
  7779. return self;},
  7780. args: ["anObject"],
  7781. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  7782. messageSends: [],
  7783. referencedClasses: []
  7784. }),
  7785. smalltalk.Array);
  7786. smalltalk.addMethod(
  7787. "_asJavascript",
  7788. smalltalk.method({
  7789. selector: "asJavascript",
  7790. category: 'converting',
  7791. fn: function (){
  7792. var self=this;
  7793. return smalltalk.send(smalltalk.send("[", "__comma", [smalltalk.send(smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJavascript", []);})]), "_join_", [", "])]), "__comma", ["]"]);
  7794. return self;},
  7795. args: [],
  7796. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  7797. messageSends: [",", "join:", "collect:", "asJavascript"],
  7798. referencedClasses: []
  7799. }),
  7800. smalltalk.Array);
  7801. smalltalk.addMethod(
  7802. "_at_ifAbsent_",
  7803. smalltalk.method({
  7804. selector: "at:ifAbsent:",
  7805. category: 'accessing',
  7806. fn: function (anIndex, aBlock){
  7807. var self=this;
  7808. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  7809. return self[anIndex - 1];
  7810. ;
  7811. return self;},
  7812. args: ["anIndex", "aBlock"],
  7813. 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>",
  7814. messageSends: [],
  7815. referencedClasses: []
  7816. }),
  7817. smalltalk.Array);
  7818. smalltalk.addMethod(
  7819. "_at_put_",
  7820. smalltalk.method({
  7821. selector: "at:put:",
  7822. category: 'accessing',
  7823. fn: function (anIndex, anObject){
  7824. var self=this;
  7825. return self[anIndex - 1] = anObject;
  7826. return self;},
  7827. args: ["anIndex", "anObject"],
  7828. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  7829. messageSends: [],
  7830. referencedClasses: []
  7831. }),
  7832. smalltalk.Array);
  7833. smalltalk.addMethod(
  7834. "_join_",
  7835. smalltalk.method({
  7836. selector: "join:",
  7837. category: 'enumerating',
  7838. fn: function (aString){
  7839. var self=this;
  7840. return self.join(aString);
  7841. return self;},
  7842. args: ["aString"],
  7843. source: "join: aString\x0a\x09<return self.join(aString)>",
  7844. messageSends: [],
  7845. referencedClasses: []
  7846. }),
  7847. smalltalk.Array);
  7848. smalltalk.addMethod(
  7849. "_remove_",
  7850. smalltalk.method({
  7851. selector: "remove:",
  7852. category: 'adding/removing',
  7853. fn: function (anObject){
  7854. var self=this;
  7855. for(var i=0;i<self.length;i++) {
  7856. if(self[i] == anObject) {
  7857. self.splice(i,1);
  7858. break;
  7859. }
  7860. }
  7861. ;
  7862. return self;},
  7863. args: ["anObject"],
  7864. source: "remove: anObject\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\x09break;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09>",
  7865. messageSends: [],
  7866. referencedClasses: []
  7867. }),
  7868. smalltalk.Array);
  7869. smalltalk.addMethod(
  7870. "_removeFrom_to_",
  7871. smalltalk.method({
  7872. selector: "removeFrom:to:",
  7873. category: 'adding/removing',
  7874. fn: function (aNumber, anotherNumber){
  7875. var self=this;
  7876. self.splice(aNumber - 1,anotherNumber - 1);
  7877. return self;},
  7878. args: ["aNumber", "anotherNumber"],
  7879. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  7880. messageSends: [],
  7881. referencedClasses: []
  7882. }),
  7883. smalltalk.Array);
  7884. smalltalk.addMethod(
  7885. "_reversed",
  7886. smalltalk.method({
  7887. selector: "reversed",
  7888. category: 'converting',
  7889. fn: function (){
  7890. var self=this;
  7891. return self._copy().reverse();
  7892. return self;},
  7893. args: [],
  7894. source: "reversed\x0a\x09<return self._copy().reverse()>",
  7895. messageSends: [],
  7896. referencedClasses: []
  7897. }),
  7898. smalltalk.Array);
  7899. smalltalk.addMethod(
  7900. "_size",
  7901. smalltalk.method({
  7902. selector: "size",
  7903. category: 'accessing',
  7904. fn: function (){
  7905. var self=this;
  7906. return self.length;
  7907. return self;},
  7908. args: [],
  7909. source: "size\x0a\x09<return self.length>",
  7910. messageSends: [],
  7911. referencedClasses: []
  7912. }),
  7913. smalltalk.Array);
  7914. smalltalk.addMethod(
  7915. "_sort",
  7916. smalltalk.method({
  7917. selector: "sort",
  7918. category: 'enumerating',
  7919. fn: function (){
  7920. var self=this;
  7921. return smalltalk.send(self, "_basicPerform_", ["sort"]);
  7922. return self;},
  7923. args: [],
  7924. source: "sort\x0a ^self basicPerform: 'sort'",
  7925. messageSends: ["basicPerform:"],
  7926. referencedClasses: []
  7927. }),
  7928. smalltalk.Array);
  7929. smalltalk.addMethod(
  7930. "_sort_",
  7931. smalltalk.method({
  7932. selector: "sort:",
  7933. category: 'enumerating',
  7934. fn: function (aBlock){
  7935. var self=this;
  7936. return self.sort(function(a, b) {
  7937. if(aBlock(a,b)) {return -1} else {return 1}
  7938. })
  7939. ;
  7940. return self;},
  7941. args: ["aBlock"],
  7942. 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>",
  7943. messageSends: [],
  7944. referencedClasses: []
  7945. }),
  7946. smalltalk.Array);
  7947. smalltalk.addMethod(
  7948. "_sorted",
  7949. smalltalk.method({
  7950. selector: "sorted",
  7951. category: 'enumerating',
  7952. fn: function (){
  7953. var self=this;
  7954. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort", []);
  7955. return self;},
  7956. args: [],
  7957. source: "sorted\x0a\x09^self copy sort",
  7958. messageSends: ["sort", "copy"],
  7959. referencedClasses: []
  7960. }),
  7961. smalltalk.Array);
  7962. smalltalk.addMethod(
  7963. "_sorted_",
  7964. smalltalk.method({
  7965. selector: "sorted:",
  7966. category: 'enumerating',
  7967. fn: function (aBlock){
  7968. var self=this;
  7969. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
  7970. return self;},
  7971. args: ["aBlock"],
  7972. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  7973. messageSends: ["sort:", "copy"],
  7974. referencedClasses: []
  7975. }),
  7976. smalltalk.Array);
  7977. smalltalk.addMethod(
  7978. "_new_",
  7979. smalltalk.method({
  7980. selector: "new:",
  7981. category: 'instance creation',
  7982. fn: function (anInteger){
  7983. var self=this;
  7984. return new Array(anInteger);
  7985. return self;},
  7986. args: ["anInteger"],
  7987. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  7988. messageSends: [],
  7989. referencedClasses: []
  7990. }),
  7991. smalltalk.Array.klass);
  7992. smalltalk.addMethod(
  7993. "_with_",
  7994. smalltalk.method({
  7995. selector: "with:",
  7996. category: 'instance creation',
  7997. fn: function (anObject){
  7998. var self=this;
  7999. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(1)]));
  8000. return self;},
  8001. args: ["anObject"],
  8002. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  8003. messageSends: ["at:put:", "yourself", "new:"],
  8004. referencedClasses: []
  8005. }),
  8006. smalltalk.Array.klass);
  8007. smalltalk.addMethod(
  8008. "_with_with_",
  8009. smalltalk.method({
  8010. selector: "with:with:",
  8011. category: 'instance creation',
  8012. fn: function (anObject, anObject2){
  8013. var self=this;
  8014. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);smalltalk.send($rec, "_at_put_", [(2), anObject2]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(2)]));
  8015. return self;},
  8016. args: ["anObject", "anObject2"],
  8017. 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",
  8018. messageSends: ["at:put:", "yourself", "new:"],
  8019. referencedClasses: []
  8020. }),
  8021. smalltalk.Array.klass);
  8022. smalltalk.addMethod(
  8023. "_with_with_with_",
  8024. smalltalk.method({
  8025. selector: "with:with:with:",
  8026. category: 'instance creation',
  8027. fn: function (anObject, anObject2, anObject3){
  8028. var self=this;
  8029. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);smalltalk.send($rec, "_at_put_", [(2), anObject2]);smalltalk.send($rec, "_at_put_", [(3), anObject3]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(3)]));
  8030. return self;},
  8031. args: ["anObject", "anObject2", "anObject3"],
  8032. 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",
  8033. messageSends: ["at:put:", "yourself", "new:"],
  8034. referencedClasses: []
  8035. }),
  8036. smalltalk.Array.klass);
  8037. smalltalk.addMethod(
  8038. "_withAll_",
  8039. smalltalk.method({
  8040. selector: "withAll:",
  8041. category: 'instance creation',
  8042. fn: function (aCollection){
  8043. var self=this;
  8044. var instance=nil;
  8045. (instance=smalltalk.send(self, "_new_", [smalltalk.send(aCollection, "_size", [])]));
  8046. smalltalk.send(aCollection, "_withIndexDo_", [(function(each, index){return smalltalk.send(instance, "_at_put_", [index, each]);})]);
  8047. return instance;
  8048. return self;},
  8049. args: ["aCollection"],
  8050. source: "withAll: aCollection\x0a\x09| instance |\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection withIndexDo: [:each :index |\x0a\x09\x09instance at: index put: each].\x0a\x09^instance",
  8051. messageSends: ["new:", "size", "withIndexDo:", "at:put:"],
  8052. referencedClasses: []
  8053. }),
  8054. smalltalk.Array.klass);
  8055. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  8056. smalltalk.addMethod(
  8057. "__comma",
  8058. smalltalk.method({
  8059. selector: ",",
  8060. category: 'copying',
  8061. fn: function (aString){
  8062. var self=this;
  8063. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", [smalltalk.send(aString, "_asString", [])]);
  8064. return self;},
  8065. args: ["aString"],
  8066. source: ", aString\x0a\x09^self asString, aString asString",
  8067. messageSends: [",", "asString"],
  8068. referencedClasses: []
  8069. }),
  8070. smalltalk.CharacterArray);
  8071. smalltalk.addMethod(
  8072. "_add_",
  8073. smalltalk.method({
  8074. selector: "add:",
  8075. category: 'adding',
  8076. fn: function (anObject){
  8077. var self=this;
  8078. smalltalk.send(self, "_errorReadOnly", []);
  8079. return self;},
  8080. args: ["anObject"],
  8081. source: "add: anObject\x0a\x09self errorReadOnly",
  8082. messageSends: ["errorReadOnly"],
  8083. referencedClasses: []
  8084. }),
  8085. smalltalk.CharacterArray);
  8086. smalltalk.addMethod(
  8087. "_asLowercase",
  8088. smalltalk.method({
  8089. selector: "asLowercase",
  8090. category: 'converting',
  8091. fn: function (){
  8092. var self=this;
  8093. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asLowercase", [])]);
  8094. return self;},
  8095. args: [],
  8096. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  8097. messageSends: ["fromString:", "class", "asLowercase", "asString"],
  8098. referencedClasses: []
  8099. }),
  8100. smalltalk.CharacterArray);
  8101. smalltalk.addMethod(
  8102. "_asNumber",
  8103. smalltalk.method({
  8104. selector: "asNumber",
  8105. category: 'converting',
  8106. fn: function (){
  8107. var self=this;
  8108. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asNumber", []);
  8109. return self;},
  8110. args: [],
  8111. source: "asNumber\x0a\x09^self asString asNumber",
  8112. messageSends: ["asNumber", "asString"],
  8113. referencedClasses: []
  8114. }),
  8115. smalltalk.CharacterArray);
  8116. smalltalk.addMethod(
  8117. "_asString",
  8118. smalltalk.method({
  8119. selector: "asString",
  8120. category: 'converting',
  8121. fn: function (){
  8122. var self=this;
  8123. return smalltalk.send(self, "_subclassResponsibility", []);
  8124. return self;},
  8125. args: [],
  8126. source: "asString\x0a\x09^self subclassResponsibility",
  8127. messageSends: ["subclassResponsibility"],
  8128. referencedClasses: []
  8129. }),
  8130. smalltalk.CharacterArray);
  8131. smalltalk.addMethod(
  8132. "_asSymbol",
  8133. smalltalk.method({
  8134. selector: "asSymbol",
  8135. category: 'converting',
  8136. fn: function (){
  8137. var self=this;
  8138. return smalltalk.send(self, "_subclassResponsibility", []);
  8139. return self;},
  8140. args: [],
  8141. source: "asSymbol\x0a\x09^self subclassResponsibility",
  8142. messageSends: ["subclassResponsibility"],
  8143. referencedClasses: []
  8144. }),
  8145. smalltalk.CharacterArray);
  8146. smalltalk.addMethod(
  8147. "_asUppercase",
  8148. smalltalk.method({
  8149. selector: "asUppercase",
  8150. category: 'converting',
  8151. fn: function (){
  8152. var self=this;
  8153. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asUppercase", [])]);
  8154. return self;},
  8155. args: [],
  8156. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  8157. messageSends: ["fromString:", "class", "asUppercase", "asString"],
  8158. referencedClasses: []
  8159. }),
  8160. smalltalk.CharacterArray);
  8161. smalltalk.addMethod(
  8162. "_at_put_",
  8163. smalltalk.method({
  8164. selector: "at:put:",
  8165. category: 'accessing',
  8166. fn: function (anIndex, anObject){
  8167. var self=this;
  8168. smalltalk.send(self, "_errorReadOnly", []);
  8169. return self;},
  8170. args: ["anIndex", "anObject"],
  8171. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  8172. messageSends: ["errorReadOnly"],
  8173. referencedClasses: []
  8174. }),
  8175. smalltalk.CharacterArray);
  8176. smalltalk.addMethod(
  8177. "_errorReadOnly",
  8178. smalltalk.method({
  8179. selector: "errorReadOnly",
  8180. category: 'error handling',
  8181. fn: function (){
  8182. var self=this;
  8183. smalltalk.send(self, "_error_", ["Object is read-only"]);
  8184. return self;},
  8185. args: [],
  8186. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  8187. messageSends: ["error:"],
  8188. referencedClasses: []
  8189. }),
  8190. smalltalk.CharacterArray);
  8191. smalltalk.addMethod(
  8192. "_printString",
  8193. smalltalk.method({
  8194. selector: "printString",
  8195. category: 'printing',
  8196. fn: function (){
  8197. var self=this;
  8198. return smalltalk.send(smalltalk.send(self, "_asString", []), "_printString", []);
  8199. return self;},
  8200. args: [],
  8201. source: "printString\x0a\x09^self asString printString",
  8202. messageSends: ["printString", "asString"],
  8203. referencedClasses: []
  8204. }),
  8205. smalltalk.CharacterArray);
  8206. smalltalk.addMethod(
  8207. "_remove_",
  8208. smalltalk.method({
  8209. selector: "remove:",
  8210. category: 'adding',
  8211. fn: function (anObject){
  8212. var self=this;
  8213. smalltalk.send(self, "_errorReadOnly", []);
  8214. return self;},
  8215. args: ["anObject"],
  8216. source: "remove: anObject\x0a\x09self errorReadOnly",
  8217. messageSends: ["errorReadOnly"],
  8218. referencedClasses: []
  8219. }),
  8220. smalltalk.CharacterArray);
  8221. smalltalk.addMethod(
  8222. "_fromString_",
  8223. smalltalk.method({
  8224. selector: "fromString:",
  8225. category: 'instance creation',
  8226. fn: function (aString){
  8227. var self=this;
  8228. smalltalk.send(self, "_subclassResponsibility", []);
  8229. return self;},
  8230. args: ["aString"],
  8231. source: "fromString: aString\x0a\x09self subclassResponsibility",
  8232. messageSends: ["subclassResponsibility"],
  8233. referencedClasses: []
  8234. }),
  8235. smalltalk.CharacterArray.klass);
  8236. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  8237. smalltalk.addMethod(
  8238. "__comma",
  8239. smalltalk.method({
  8240. selector: ",",
  8241. category: 'copying',
  8242. fn: function (aString){
  8243. var self=this;
  8244. return self + aString;
  8245. return self;},
  8246. args: ["aString"],
  8247. source: ", aString\x0a\x09<return self + aString>",
  8248. messageSends: [],
  8249. referencedClasses: []
  8250. }),
  8251. smalltalk.String);
  8252. smalltalk.addMethod(
  8253. "__lt",
  8254. smalltalk.method({
  8255. selector: "<",
  8256. category: 'comparing',
  8257. fn: function (aString){
  8258. var self=this;
  8259. return String(self) < aString._asString();
  8260. return self;},
  8261. args: ["aString"],
  8262. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  8263. messageSends: [],
  8264. referencedClasses: []
  8265. }),
  8266. smalltalk.String);
  8267. smalltalk.addMethod(
  8268. "__lt_eq",
  8269. smalltalk.method({
  8270. selector: "<=",
  8271. category: 'comparing',
  8272. fn: function (aString){
  8273. var self=this;
  8274. return String(self) <= aString._asString();
  8275. return self;},
  8276. args: ["aString"],
  8277. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  8278. messageSends: [],
  8279. referencedClasses: []
  8280. }),
  8281. smalltalk.String);
  8282. smalltalk.addMethod(
  8283. "__eq",
  8284. smalltalk.method({
  8285. selector: "=",
  8286. category: 'comparing',
  8287. fn: function (aString){
  8288. var self=this;
  8289. var $early={};
  8290. try{((($receiver = smalltalk.send(smalltalk.send(aString, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  8291. return String(self) === String(aString);
  8292. return self;
  8293. } catch(e) {if(e===$early)return e[0]; throw e}},
  8294. args: ["aString"],
  8295. source: "= aString\x0a\x09aString class = self class ifFalse: [^false].\x0a\x09<return String(self) === String(aString)>",
  8296. messageSends: ["ifFalse:", "=", "class"],
  8297. referencedClasses: []
  8298. }),
  8299. smalltalk.String);
  8300. smalltalk.addMethod(
  8301. "__eq_eq",
  8302. smalltalk.method({
  8303. selector: "==",
  8304. category: 'comparing',
  8305. fn: function (aString){
  8306. var self=this;
  8307. return smalltalk.send(self, "__eq", [aString]);
  8308. return self;},
  8309. args: ["aString"],
  8310. source: "== aString\x0a\x09^self = aString",
  8311. messageSends: ["="],
  8312. referencedClasses: []
  8313. }),
  8314. smalltalk.String);
  8315. smalltalk.addMethod(
  8316. "__gt",
  8317. smalltalk.method({
  8318. selector: ">",
  8319. category: 'comparing',
  8320. fn: function (aString){
  8321. var self=this;
  8322. return String(self) > aString._asString();
  8323. return self;},
  8324. args: ["aString"],
  8325. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  8326. messageSends: [],
  8327. referencedClasses: []
  8328. }),
  8329. smalltalk.String);
  8330. smalltalk.addMethod(
  8331. "__gt_eq",
  8332. smalltalk.method({
  8333. selector: ">=",
  8334. category: 'comparing',
  8335. fn: function (aString){
  8336. var self=this;
  8337. return String(self) >= aString._asString();
  8338. return self;},
  8339. args: ["aString"],
  8340. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  8341. messageSends: [],
  8342. referencedClasses: []
  8343. }),
  8344. smalltalk.String);
  8345. smalltalk.addMethod(
  8346. "_asJSON",
  8347. smalltalk.method({
  8348. selector: "asJSON",
  8349. category: 'converting',
  8350. fn: function (){
  8351. var self=this;
  8352. return self;
  8353. return self;},
  8354. args: [],
  8355. source: "asJSON\x0a\x09^self",
  8356. messageSends: [],
  8357. referencedClasses: []
  8358. }),
  8359. smalltalk.String);
  8360. smalltalk.addMethod(
  8361. "_asJavaScriptSelector",
  8362. smalltalk.method({
  8363. selector: "asJavaScriptSelector",
  8364. category: 'converting',
  8365. fn: function (){
  8366. var self=this;
  8367. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asSelector", []), "_replace_with_", ["^_", ""]), "_replace_with_", ["_.*", ""]);
  8368. return self;},
  8369. args: [],
  8370. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  8371. messageSends: ["replace:with:", "asSelector"],
  8372. referencedClasses: []
  8373. }),
  8374. smalltalk.String);
  8375. smalltalk.addMethod(
  8376. "_asJavascript",
  8377. smalltalk.method({
  8378. selector: "asJavascript",
  8379. category: 'converting',
  8380. fn: function (){
  8381. var self=this;
  8382. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  8383. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  8384. else
  8385. return "\"" + self + "\"";
  8386. ;
  8387. return self;},
  8388. args: [],
  8389. 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>",
  8390. messageSends: [],
  8391. referencedClasses: []
  8392. }),
  8393. smalltalk.String);
  8394. smalltalk.addMethod(
  8395. "_asLowercase",
  8396. smalltalk.method({
  8397. selector: "asLowercase",
  8398. category: 'converting',
  8399. fn: function (){
  8400. var self=this;
  8401. return self.toLowerCase();
  8402. return self;},
  8403. args: [],
  8404. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  8405. messageSends: [],
  8406. referencedClasses: []
  8407. }),
  8408. smalltalk.String);
  8409. smalltalk.addMethod(
  8410. "_asNumber",
  8411. smalltalk.method({
  8412. selector: "asNumber",
  8413. category: 'converting',
  8414. fn: function (){
  8415. var self=this;
  8416. return Number(self);
  8417. return self;},
  8418. args: [],
  8419. source: "asNumber\x0a\x09<return Number(self)>",
  8420. messageSends: [],
  8421. referencedClasses: []
  8422. }),
  8423. smalltalk.String);
  8424. smalltalk.addMethod(
  8425. "_asSelector",
  8426. smalltalk.method({
  8427. selector: "asSelector",
  8428. category: 'converting',
  8429. fn: function (){
  8430. var self=this;
  8431. var selector=nil;
  8432. (selector=smalltalk.send("_", "__comma", [self]));
  8433. (selector=smalltalk.send(selector, "_replace_with_", [":", "_"]));
  8434. (selector=smalltalk.send(selector, "_replace_with_", ["[+]", "_plus"]));
  8435. (selector=smalltalk.send(selector, "_replace_with_", ["-", "_minus"]));
  8436. (selector=smalltalk.send(selector, "_replace_with_", ["[*]", "_star"]));
  8437. (selector=smalltalk.send(selector, "_replace_with_", ["[/]", "_slash"]));
  8438. (selector=smalltalk.send(selector, "_replace_with_", [">", "_gt"]));
  8439. (selector=smalltalk.send(selector, "_replace_with_", ["<", "_lt"]));
  8440. (selector=smalltalk.send(selector, "_replace_with_", ["=", "_eq"]));
  8441. (selector=smalltalk.send(selector, "_replace_with_", [",", "_comma"]));
  8442. (selector=smalltalk.send(selector, "_replace_with_", ["[@]", "_at"]));
  8443. return selector;
  8444. return self;},
  8445. args: [],
  8446. source: "asSelector\x0a\x09\x22If you change this method, change smalltalk.convertSelector too (see js/boot.js file)\x22\x0a\x0a\x09| selector |\x0a\x09selector := '_', self.\x0a\x09selector := selector replace: ':' with: '_'.\x0a\x09selector := selector replace: '[+]' with: '_plus'.\x0a\x09selector := selector replace: '-' with: '_minus'.\x0a\x09selector := selector replace: '[*]' with: '_star'.\x0a\x09selector := selector replace: '[/]' with: '_slash'.\x0a\x09selector := selector replace: '>' with: '_gt'.\x0a\x09selector := selector replace: '<' with: '_lt'.\x0a\x09selector := selector replace: '=' with: '_eq'.\x0a\x09selector := selector replace: ',' with: '_comma'.\x0a\x09selector := selector replace: '[@]' with: '_at'.\x0a\x09^selector",
  8447. messageSends: [",", "replace:with:"],
  8448. referencedClasses: []
  8449. }),
  8450. smalltalk.String);
  8451. smalltalk.addMethod(
  8452. "_asString",
  8453. smalltalk.method({
  8454. selector: "asString",
  8455. category: 'converting',
  8456. fn: function (){
  8457. var self=this;
  8458. return self;
  8459. return self;},
  8460. args: [],
  8461. source: "asString\x0a\x09^self",
  8462. messageSends: [],
  8463. referencedClasses: []
  8464. }),
  8465. smalltalk.String);
  8466. smalltalk.addMethod(
  8467. "_asSymbol",
  8468. smalltalk.method({
  8469. selector: "asSymbol",
  8470. category: 'converting',
  8471. fn: function (){
  8472. var self=this;
  8473. return smalltalk.send((smalltalk.Symbol || Symbol), "_lookup_", [self]);
  8474. return self;},
  8475. args: [],
  8476. source: "asSymbol\x0a\x09^Symbol lookup: self",
  8477. messageSends: ["lookup:"],
  8478. referencedClasses: ["Symbol"]
  8479. }),
  8480. smalltalk.String);
  8481. smalltalk.addMethod(
  8482. "_asUppercase",
  8483. smalltalk.method({
  8484. selector: "asUppercase",
  8485. category: 'converting',
  8486. fn: function (){
  8487. var self=this;
  8488. return self.toUpperCase();
  8489. return self;},
  8490. args: [],
  8491. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  8492. messageSends: [],
  8493. referencedClasses: []
  8494. }),
  8495. smalltalk.String);
  8496. smalltalk.addMethod(
  8497. "_asciiValue",
  8498. smalltalk.method({
  8499. selector: "asciiValue",
  8500. category: 'accessing',
  8501. fn: function (){
  8502. var self=this;
  8503. return self.charCodeAt(0);;
  8504. return self;},
  8505. args: [],
  8506. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  8507. messageSends: [],
  8508. referencedClasses: []
  8509. }),
  8510. smalltalk.String);
  8511. smalltalk.addMethod(
  8512. "_at_ifAbsent_",
  8513. smalltalk.method({
  8514. selector: "at:ifAbsent:",
  8515. category: 'accessing',
  8516. fn: function (anIndex, aBlock){
  8517. var self=this;
  8518. return self[anIndex - 1] || aBlock();
  8519. return self;},
  8520. args: ["anIndex", "aBlock"],
  8521. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return self[anIndex - 1] || aBlock()>",
  8522. messageSends: [],
  8523. referencedClasses: []
  8524. }),
  8525. smalltalk.String);
  8526. smalltalk.addMethod(
  8527. "_copyFrom_to_",
  8528. smalltalk.method({
  8529. selector: "copyFrom:to:",
  8530. category: 'copying',
  8531. fn: function (anIndex, anotherIndex){
  8532. var self=this;
  8533. return self.substring(anIndex - 1, anotherIndex);
  8534. return self;},
  8535. args: ["anIndex", "anotherIndex"],
  8536. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  8537. messageSends: [],
  8538. referencedClasses: []
  8539. }),
  8540. smalltalk.String);
  8541. smalltalk.addMethod(
  8542. "_deepCopy",
  8543. smalltalk.method({
  8544. selector: "deepCopy",
  8545. category: 'copying',
  8546. fn: function (){
  8547. var self=this;
  8548. return smalltalk.send(self, "_shallowCopy", []);
  8549. return self;},
  8550. args: [],
  8551. source: "deepCopy\x0a\x09^self shallowCopy",
  8552. messageSends: ["shallowCopy"],
  8553. referencedClasses: []
  8554. }),
  8555. smalltalk.String);
  8556. smalltalk.addMethod(
  8557. "_escaped",
  8558. smalltalk.method({
  8559. selector: "escaped",
  8560. category: 'accessing',
  8561. fn: function (){
  8562. var self=this;
  8563. return escape(self);
  8564. return self;},
  8565. args: [],
  8566. source: "escaped\x0a\x09<return escape(self)>",
  8567. messageSends: [],
  8568. referencedClasses: []
  8569. }),
  8570. smalltalk.String);
  8571. smalltalk.addMethod(
  8572. "_includesSubString_",
  8573. smalltalk.method({
  8574. selector: "includesSubString:",
  8575. category: 'testing',
  8576. fn: function (subString){
  8577. var self=this;
  8578. return self.indexOf(subString) != -1 ;
  8579. return self;},
  8580. args: ["subString"],
  8581. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  8582. messageSends: [],
  8583. referencedClasses: []
  8584. }),
  8585. smalltalk.String);
  8586. smalltalk.addMethod(
  8587. "_isString",
  8588. smalltalk.method({
  8589. selector: "isString",
  8590. category: 'testing',
  8591. fn: function (){
  8592. var self=this;
  8593. return true;
  8594. return self;},
  8595. args: [],
  8596. source: "isString\x0a\x09^true",
  8597. messageSends: [],
  8598. referencedClasses: []
  8599. }),
  8600. smalltalk.String);
  8601. smalltalk.addMethod(
  8602. "_join_",
  8603. smalltalk.method({
  8604. selector: "join:",
  8605. category: 'split join',
  8606. fn: function (aCollection){
  8607. var self=this;
  8608. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){return smalltalk.send(aCollection, "_do_separatedBy_", [(function(each){return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(each, "_asString", [])]);}), (function(){return smalltalk.send(stream, "_nextPutAll_", [self]);})]);})]);
  8609. return self;},
  8610. args: ["aCollection"],
  8611. 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]]",
  8612. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  8613. referencedClasses: ["String"]
  8614. }),
  8615. smalltalk.String);
  8616. smalltalk.addMethod(
  8617. "_lineIndicesDo_",
  8618. smalltalk.method({
  8619. selector: "lineIndicesDo:",
  8620. category: 'split join',
  8621. fn: function (aBlock){
  8622. var self=this;
  8623. var $early={};
  8624. try{var cr=nil;
  8625. var lf=nil;
  8626. var start=nil;
  8627. var sz=nil;
  8628. var nextLF=nil;
  8629. var nextCR=nil;
  8630. (start=(1));
  8631. (sz=smalltalk.send(self, "_size", []));
  8632. (cr=smalltalk.send((smalltalk.String || String), "_cr", []));
  8633. (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, (1)]));
  8634. (lf=smalltalk.send((smalltalk.String || String), "_lf", []));
  8635. (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, (1)]));
  8636. (function(){while((function(){return ((($receiver = start).klass === smalltalk.Number) ? $receiver <=sz : smalltalk.send($receiver, "__lt_eq", [sz]));})()) {(function(){((($receiver = smalltalk.send(smalltalk.send(nextLF, "__eq", [(0)]), "_and_", [(function(){return smalltalk.send(nextCR, "__eq", [(0)]);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, sz, sz]);return (function(){throw $early=[self]})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, sz, sz]);return (function(){throw $early=[self]})();})]));return ((($receiver = smalltalk.send(smalltalk.send(nextCR, "__eq", [(0)]), "_or_", [(function(){return smalltalk.send((0) < nextLF, "_and_", [(function(){return ((($receiver = nextLF).klass === smalltalk.Number) ? $receiver <nextCR : smalltalk.send($receiver, "__lt", [nextCR]));})]);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextLF).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));})() : (function(){return ((($receiver = smalltalk.send((1) + nextCR, "__eq", [nextLF])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));})() : (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));}), (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextLF).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));}), (function(){return ((($receiver = smalltalk.send((1) + nextCR, "__eq", [nextLF])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));})() : (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));}), (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})]));})]));})()}})();
  8637. return self;
  8638. } catch(e) {if(e===$early)return e[0]; throw e}},
  8639. args: ["aBlock"],
  8640. 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 ]]]",
  8641. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"],
  8642. referencedClasses: ["String"]
  8643. }),
  8644. smalltalk.String);
  8645. smalltalk.addMethod(
  8646. "_lineNumber_",
  8647. smalltalk.method({
  8648. selector: "lineNumber:",
  8649. category: 'split join',
  8650. fn: function (anIndex){
  8651. var self=this;
  8652. var $early={};
  8653. try{var lineCount=nil;
  8654. (lineCount=(0));
  8655. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return ((($receiver = smalltalk.send((lineCount=((($receiver = lineCount).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))), "__eq", [anIndex])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){throw $early=[smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function(){throw $early=[smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]})();})]));})]);
  8656. return nil;
  8657. return self;
  8658. } catch(e) {if(e===$early)return e[0]; throw e}},
  8659. args: ["anIndex"],
  8660. 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",
  8661. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"],
  8662. referencedClasses: []
  8663. }),
  8664. smalltalk.String);
  8665. smalltalk.addMethod(
  8666. "_lines",
  8667. smalltalk.method({
  8668. selector: "lines",
  8669. category: 'split join',
  8670. fn: function (){
  8671. var self=this;
  8672. var lines=nil;
  8673. (lines=smalltalk.send((smalltalk.Array || Array), "_new", []));
  8674. smalltalk.send(self, "_linesDo_", [(function(aLine){return smalltalk.send(lines, "_add_", [aLine]);})]);
  8675. return lines;
  8676. return self;},
  8677. args: [],
  8678. 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",
  8679. messageSends: ["new", "linesDo:", "add:"],
  8680. referencedClasses: ["Array"]
  8681. }),
  8682. smalltalk.String);
  8683. smalltalk.addMethod(
  8684. "_linesDo_",
  8685. smalltalk.method({
  8686. selector: "linesDo:",
  8687. category: 'split join',
  8688. fn: function (aBlock){
  8689. var self=this;
  8690. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]);})]);
  8691. return self;},
  8692. args: ["aBlock"],
  8693. 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)]",
  8694. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  8695. referencedClasses: []
  8696. }),
  8697. smalltalk.String);
  8698. smalltalk.addMethod(
  8699. "_match_",
  8700. smalltalk.method({
  8701. selector: "match:",
  8702. category: 'regular expressions',
  8703. fn: function (aRegexp){
  8704. var self=this;
  8705. return self.search(aRegexp) != -1;
  8706. return self;},
  8707. args: ["aRegexp"],
  8708. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  8709. messageSends: [],
  8710. referencedClasses: []
  8711. }),
  8712. smalltalk.String);
  8713. smalltalk.addMethod(
  8714. "_matchesOf_",
  8715. smalltalk.method({
  8716. selector: "matchesOf:",
  8717. category: 'regular expressions',
  8718. fn: function (aRegularExpression){
  8719. var self=this;
  8720. return self.match(aRegularExpression);
  8721. return self;},
  8722. args: ["aRegularExpression"],
  8723. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  8724. messageSends: [],
  8725. referencedClasses: []
  8726. }),
  8727. smalltalk.String);
  8728. smalltalk.addMethod(
  8729. "_printNl",
  8730. smalltalk.method({
  8731. selector: "printNl",
  8732. category: 'printing',
  8733. fn: function (){
  8734. var self=this;
  8735. console.log(self);
  8736. return self;},
  8737. args: [],
  8738. source: "printNl\x0a\x09<console.log(self)>",
  8739. messageSends: [],
  8740. referencedClasses: []
  8741. }),
  8742. smalltalk.String);
  8743. smalltalk.addMethod(
  8744. "_printString",
  8745. smalltalk.method({
  8746. selector: "printString",
  8747. category: 'printing',
  8748. fn: function (){
  8749. var self=this;
  8750. return smalltalk.send(smalltalk.send("'", "__comma", [self]), "__comma", ["'"]);
  8751. return self;},
  8752. args: [],
  8753. source: "printString\x0a\x09^'''', self, ''''",
  8754. messageSends: [","],
  8755. referencedClasses: []
  8756. }),
  8757. smalltalk.String);
  8758. smalltalk.addMethod(
  8759. "_replace_with_",
  8760. smalltalk.method({
  8761. selector: "replace:with:",
  8762. category: 'regular expressions',
  8763. fn: function (aString, anotherString){
  8764. var self=this;
  8765. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [aString, "g"]), anotherString]);
  8766. return self;},
  8767. args: ["aString", "anotherString"],
  8768. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  8769. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  8770. referencedClasses: ["RegularExpression"]
  8771. }),
  8772. smalltalk.String);
  8773. smalltalk.addMethod(
  8774. "_replaceRegexp_with_",
  8775. smalltalk.method({
  8776. selector: "replaceRegexp:with:",
  8777. category: 'regular expressions',
  8778. fn: function (aRegexp, aString){
  8779. var self=this;
  8780. return self.replace(aRegexp, aString);
  8781. return self;},
  8782. args: ["aRegexp", "aString"],
  8783. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  8784. messageSends: [],
  8785. referencedClasses: []
  8786. }),
  8787. smalltalk.String);
  8788. smalltalk.addMethod(
  8789. "_reversed",
  8790. smalltalk.method({
  8791. selector: "reversed",
  8792. category: 'converting',
  8793. fn: function (){
  8794. var self=this;
  8795. return self.split("").reverse().join("");
  8796. return self;},
  8797. args: [],
  8798. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  8799. messageSends: [],
  8800. referencedClasses: []
  8801. }),
  8802. smalltalk.String);
  8803. smalltalk.addMethod(
  8804. "_shallowCopy",
  8805. smalltalk.method({
  8806. selector: "shallowCopy",
  8807. category: 'copying',
  8808. fn: function (){
  8809. var self=this;
  8810. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [self]);
  8811. return self;},
  8812. args: [],
  8813. source: "shallowCopy\x0a\x09^self class fromString: self",
  8814. messageSends: ["fromString:", "class"],
  8815. referencedClasses: []
  8816. }),
  8817. smalltalk.String);
  8818. smalltalk.addMethod(
  8819. "_size",
  8820. smalltalk.method({
  8821. selector: "size",
  8822. category: 'accessing',
  8823. fn: function (){
  8824. var self=this;
  8825. return self.length;
  8826. return self;},
  8827. args: [],
  8828. source: "size\x0a\x09<return self.length>",
  8829. messageSends: [],
  8830. referencedClasses: []
  8831. }),
  8832. smalltalk.String);
  8833. smalltalk.addMethod(
  8834. "_tokenize_",
  8835. smalltalk.method({
  8836. selector: "tokenize:",
  8837. category: 'converting',
  8838. fn: function (aString){
  8839. var self=this;
  8840. return self.split(aString);
  8841. return self;},
  8842. args: ["aString"],
  8843. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  8844. messageSends: [],
  8845. referencedClasses: []
  8846. }),
  8847. smalltalk.String);
  8848. smalltalk.addMethod(
  8849. "_trimBoth",
  8850. smalltalk.method({
  8851. selector: "trimBoth",
  8852. category: 'regular expressions',
  8853. fn: function (){
  8854. var self=this;
  8855. return smalltalk.send(self, "_trimBoth_", ["\x5cs"]);
  8856. return self;},
  8857. args: [],
  8858. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  8859. messageSends: ["trimBoth:"],
  8860. referencedClasses: []
  8861. }),
  8862. smalltalk.String);
  8863. smalltalk.addMethod(
  8864. "_trimBoth_",
  8865. smalltalk.method({
  8866. selector: "trimBoth:",
  8867. category: 'regular expressions',
  8868. fn: function (separators){
  8869. var self=this;
  8870. return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]);
  8871. return self;},
  8872. args: ["separators"],
  8873. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  8874. messageSends: ["trimRight:", "trimLeft:"],
  8875. referencedClasses: []
  8876. }),
  8877. smalltalk.String);
  8878. smalltalk.addMethod(
  8879. "_trimLeft",
  8880. smalltalk.method({
  8881. selector: "trimLeft",
  8882. category: 'regular expressions',
  8883. fn: function (){
  8884. var self=this;
  8885. return smalltalk.send(self, "_trimLeft_", ["\x5cs"]);
  8886. return self;},
  8887. args: [],
  8888. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  8889. messageSends: ["trimLeft:"],
  8890. referencedClasses: []
  8891. }),
  8892. smalltalk.String);
  8893. smalltalk.addMethod(
  8894. "_trimLeft_",
  8895. smalltalk.method({
  8896. selector: "trimLeft:",
  8897. category: 'regular expressions',
  8898. fn: function (separators){
  8899. var self=this;
  8900. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("^[", "__comma", [separators]), "__comma", ["]+"]), "g"]), ""]);
  8901. return self;},
  8902. args: ["separators"],
  8903. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  8904. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  8905. referencedClasses: ["RegularExpression"]
  8906. }),
  8907. smalltalk.String);
  8908. smalltalk.addMethod(
  8909. "_trimRight",
  8910. smalltalk.method({
  8911. selector: "trimRight",
  8912. category: 'regular expressions',
  8913. fn: function (){
  8914. var self=this;
  8915. return smalltalk.send(self, "_trimRight_", ["\x5cs"]);
  8916. return self;},
  8917. args: [],
  8918. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  8919. messageSends: ["trimRight:"],
  8920. referencedClasses: []
  8921. }),
  8922. smalltalk.String);
  8923. smalltalk.addMethod(
  8924. "_trimRight_",
  8925. smalltalk.method({
  8926. selector: "trimRight:",
  8927. category: 'regular expressions',
  8928. fn: function (separators){
  8929. var self=this;
  8930. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("[", "__comma", [separators]), "__comma", ["]+$"]), "g"]), ""]);
  8931. return self;},
  8932. args: ["separators"],
  8933. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  8934. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  8935. referencedClasses: ["RegularExpression"]
  8936. }),
  8937. smalltalk.String);
  8938. smalltalk.addMethod(
  8939. "_unescaped",
  8940. smalltalk.method({
  8941. selector: "unescaped",
  8942. category: 'accessing',
  8943. fn: function (){
  8944. var self=this;
  8945. return unescape(self);
  8946. return self;},
  8947. args: [],
  8948. source: "unescaped\x0a\x09<return unescape(self)>",
  8949. messageSends: [],
  8950. referencedClasses: []
  8951. }),
  8952. smalltalk.String);
  8953. smalltalk.addMethod(
  8954. "_cr",
  8955. smalltalk.method({
  8956. selector: "cr",
  8957. category: 'accessing',
  8958. fn: function (){
  8959. var self=this;
  8960. return '\r';
  8961. return self;},
  8962. args: [],
  8963. source: "cr\x0a\x09<return '\x5cr'>",
  8964. messageSends: [],
  8965. referencedClasses: []
  8966. }),
  8967. smalltalk.String.klass);
  8968. smalltalk.addMethod(
  8969. "_crlf",
  8970. smalltalk.method({
  8971. selector: "crlf",
  8972. category: 'accessing',
  8973. fn: function (){
  8974. var self=this;
  8975. return '\r\n';
  8976. return self;},
  8977. args: [],
  8978. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  8979. messageSends: [],
  8980. referencedClasses: []
  8981. }),
  8982. smalltalk.String.klass);
  8983. smalltalk.addMethod(
  8984. "_fromString_",
  8985. smalltalk.method({
  8986. selector: "fromString:",
  8987. category: 'instance creation',
  8988. fn: function (aString){
  8989. var self=this;
  8990. return new self.fn(aString);
  8991. return self;},
  8992. args: ["aString"],
  8993. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  8994. messageSends: [],
  8995. referencedClasses: []
  8996. }),
  8997. smalltalk.String.klass);
  8998. smalltalk.addMethod(
  8999. "_lf",
  9000. smalltalk.method({
  9001. selector: "lf",
  9002. category: 'accessing',
  9003. fn: function (){
  9004. var self=this;
  9005. return '\n';
  9006. return self;},
  9007. args: [],
  9008. source: "lf\x0a\x09<return '\x5cn'>",
  9009. messageSends: [],
  9010. referencedClasses: []
  9011. }),
  9012. smalltalk.String.klass);
  9013. smalltalk.addMethod(
  9014. "_space",
  9015. smalltalk.method({
  9016. selector: "space",
  9017. category: 'accessing',
  9018. fn: function (){
  9019. var self=this;
  9020. return ' ';
  9021. return self;},
  9022. args: [],
  9023. source: "space\x0a\x09<return ' '>",
  9024. messageSends: [],
  9025. referencedClasses: []
  9026. }),
  9027. smalltalk.String.klass);
  9028. smalltalk.addMethod(
  9029. "_streamClass",
  9030. smalltalk.method({
  9031. selector: "streamClass",
  9032. category: 'accessing',
  9033. fn: function (){
  9034. var self=this;
  9035. return (smalltalk.StringStream || StringStream);
  9036. return self;},
  9037. args: [],
  9038. source: "streamClass\x0a\x09 ^StringStream",
  9039. messageSends: [],
  9040. referencedClasses: ["StringStream"]
  9041. }),
  9042. smalltalk.String.klass);
  9043. smalltalk.addMethod(
  9044. "_streamContents_",
  9045. smalltalk.method({
  9046. selector: "streamContents:",
  9047. category: 'instance creation',
  9048. fn: function (blockWithArg){
  9049. var self=this;
  9050. var stream=nil;
  9051. (stream=smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [smalltalk.send((smalltalk.String || String), "_new", [])]));
  9052. smalltalk.send(blockWithArg, "_value_", [stream]);
  9053. return smalltalk.send(stream, "_contents", []);
  9054. return self;},
  9055. args: ["blockWithArg"],
  9056. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  9057. messageSends: ["on:", "streamClass", "new", "value:", "contents"],
  9058. referencedClasses: ["String"]
  9059. }),
  9060. smalltalk.String.klass);
  9061. smalltalk.addMethod(
  9062. "_tab",
  9063. smalltalk.method({
  9064. selector: "tab",
  9065. category: 'accessing',
  9066. fn: function (){
  9067. var self=this;
  9068. return '\t';
  9069. return self;},
  9070. args: [],
  9071. source: "tab\x0a\x09<return '\x5ct'>",
  9072. messageSends: [],
  9073. referencedClasses: []
  9074. }),
  9075. smalltalk.String.klass);
  9076. smalltalk.addMethod(
  9077. "_value_",
  9078. smalltalk.method({
  9079. selector: "value:",
  9080. category: 'instance creation',
  9081. fn: function (aUTFCharCode){
  9082. var self=this;
  9083. return String.fromCharCode(aUTFCharCode);;
  9084. return self;},
  9085. args: ["aUTFCharCode"],
  9086. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  9087. messageSends: [],
  9088. referencedClasses: []
  9089. }),
  9090. smalltalk.String.klass);
  9091. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  9092. smalltalk.addMethod(
  9093. "__lt",
  9094. smalltalk.method({
  9095. selector: "<",
  9096. category: 'comparing',
  9097. fn: function (aSymbol){
  9098. var self=this;
  9099. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(aSymbol, "_asString", [])]));
  9100. return self;},
  9101. args: ["aSymbol"],
  9102. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  9103. messageSends: ["<", "asString"],
  9104. referencedClasses: []
  9105. }),
  9106. smalltalk.Symbol);
  9107. smalltalk.addMethod(
  9108. "__lt_eq",
  9109. smalltalk.method({
  9110. selector: "<=",
  9111. category: 'comparing',
  9112. fn: function (aSymbol){
  9113. var self=this;
  9114. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  9115. return self;},
  9116. args: ["aSymbol"],
  9117. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  9118. messageSends: ["<=", "asString"],
  9119. referencedClasses: []
  9120. }),
  9121. smalltalk.Symbol);
  9122. smalltalk.addMethod(
  9123. "__eq",
  9124. smalltalk.method({
  9125. selector: "=",
  9126. category: 'comparing',
  9127. fn: function (aSymbol){
  9128. var self=this;
  9129. var $early={};
  9130. try{((($receiver = smalltalk.send(smalltalk.send(aSymbol, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  9131. return smalltalk.send(smalltalk.send(self, "_asString", []), "__eq", [smalltalk.send(aSymbol, "_asString", [])]);
  9132. return self;
  9133. } catch(e) {if(e===$early)return e[0]; throw e}},
  9134. args: ["aSymbol"],
  9135. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  9136. messageSends: ["ifFalse:", "=", "class", "asString"],
  9137. referencedClasses: []
  9138. }),
  9139. smalltalk.Symbol);
  9140. smalltalk.addMethod(
  9141. "__gt",
  9142. smalltalk.method({
  9143. selector: ">",
  9144. category: 'comparing',
  9145. fn: function (aSymbol){
  9146. var self=this;
  9147. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt", [smalltalk.send(aSymbol, "_asString", [])]));
  9148. return self;},
  9149. args: ["aSymbol"],
  9150. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  9151. messageSends: [">", "asString"],
  9152. referencedClasses: []
  9153. }),
  9154. smalltalk.Symbol);
  9155. smalltalk.addMethod(
  9156. "__gt_eq",
  9157. smalltalk.method({
  9158. selector: ">=",
  9159. category: 'comparing',
  9160. fn: function (aSymbol){
  9161. var self=this;
  9162. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  9163. return self;},
  9164. args: ["aSymbol"],
  9165. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  9166. messageSends: [">=", "asString"],
  9167. referencedClasses: []
  9168. }),
  9169. smalltalk.Symbol);
  9170. smalltalk.addMethod(
  9171. "_asJSON",
  9172. smalltalk.method({
  9173. selector: "asJSON",
  9174. category: 'converting',
  9175. fn: function (){
  9176. var self=this;
  9177. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asJSON", []);
  9178. return self;},
  9179. args: [],
  9180. source: "asJSON\x0a\x09^self asString asJSON",
  9181. messageSends: ["asJSON", "asString"],
  9182. referencedClasses: []
  9183. }),
  9184. smalltalk.Symbol);
  9185. smalltalk.addMethod(
  9186. "_asJavascript",
  9187. smalltalk.method({
  9188. selector: "asJavascript",
  9189. category: 'converting',
  9190. fn: function (){
  9191. var self=this;
  9192. return smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22", "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", ["\x22)"]);
  9193. return self;},
  9194. args: [],
  9195. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(\x22', self asString, '\x22)'",
  9196. messageSends: [",", "asString"],
  9197. referencedClasses: []
  9198. }),
  9199. smalltalk.Symbol);
  9200. smalltalk.addMethod(
  9201. "_asSelector",
  9202. smalltalk.method({
  9203. selector: "asSelector",
  9204. category: 'converting',
  9205. fn: function (){
  9206. var self=this;
  9207. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asSelector", []);
  9208. return self;},
  9209. args: [],
  9210. source: "asSelector\x0a\x09^self asString asSelector",
  9211. messageSends: ["asSelector", "asString"],
  9212. referencedClasses: []
  9213. }),
  9214. smalltalk.Symbol);
  9215. smalltalk.addMethod(
  9216. "_asString",
  9217. smalltalk.method({
  9218. selector: "asString",
  9219. category: 'converting',
  9220. fn: function (){
  9221. var self=this;
  9222. return self.value;
  9223. return self;},
  9224. args: [],
  9225. source: "asString\x0a\x09<return self.value>",
  9226. messageSends: [],
  9227. referencedClasses: []
  9228. }),
  9229. smalltalk.Symbol);
  9230. smalltalk.addMethod(
  9231. "_asSymbol",
  9232. smalltalk.method({
  9233. selector: "asSymbol",
  9234. category: 'converting',
  9235. fn: function (){
  9236. var self=this;
  9237. return self;
  9238. return self;},
  9239. args: [],
  9240. source: "asSymbol\x0a\x09^self",
  9241. messageSends: [],
  9242. referencedClasses: []
  9243. }),
  9244. smalltalk.Symbol);
  9245. smalltalk.addMethod(
  9246. "_at_ifAbsent_",
  9247. smalltalk.method({
  9248. selector: "at:ifAbsent:",
  9249. category: 'accessing',
  9250. fn: function (anIndex, aBlock){
  9251. var self=this;
  9252. return smalltalk.send(smalltalk.send(self, "_asString", []), "_at_ifAbsent_", [anIndex, aBlock]);
  9253. return self;},
  9254. args: ["anIndex", "aBlock"],
  9255. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  9256. messageSends: ["at:ifAbsent:", "asString"],
  9257. referencedClasses: []
  9258. }),
  9259. smalltalk.Symbol);
  9260. smalltalk.addMethod(
  9261. "_copyFrom_to_",
  9262. smalltalk.method({
  9263. selector: "copyFrom:to:",
  9264. category: 'copying',
  9265. fn: function (anIndex, anotherIndex){
  9266. var self=this;
  9267. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_copyFrom_to_", [anIndex, anotherIndex])]);
  9268. return self;},
  9269. args: ["anIndex", "anotherIndex"],
  9270. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  9271. messageSends: ["fromString:", "class", "copyFrom:to:", "asString"],
  9272. referencedClasses: []
  9273. }),
  9274. smalltalk.Symbol);
  9275. smalltalk.addMethod(
  9276. "_deepCopy",
  9277. smalltalk.method({
  9278. selector: "deepCopy",
  9279. category: 'copying',
  9280. fn: function (){
  9281. var self=this;
  9282. return self;
  9283. return self;},
  9284. args: [],
  9285. source: "deepCopy\x0a\x09^self",
  9286. messageSends: [],
  9287. referencedClasses: []
  9288. }),
  9289. smalltalk.Symbol);
  9290. smalltalk.addMethod(
  9291. "_isSymbol",
  9292. smalltalk.method({
  9293. selector: "isSymbol",
  9294. category: 'printing',
  9295. fn: function (){
  9296. var self=this;
  9297. return true;
  9298. return self;},
  9299. args: [],
  9300. source: "isSymbol\x0a\x09^true",
  9301. messageSends: [],
  9302. referencedClasses: []
  9303. }),
  9304. smalltalk.Symbol);
  9305. smalltalk.addMethod(
  9306. "_printString",
  9307. smalltalk.method({
  9308. selector: "printString",
  9309. category: 'printing',
  9310. fn: function (){
  9311. var self=this;
  9312. return smalltalk.send("#", "__comma", [smalltalk.send(self, "_asString", [])]);
  9313. return self;},
  9314. args: [],
  9315. source: "printString\x0a\x09^'#', self asString",
  9316. messageSends: [",", "asString"],
  9317. referencedClasses: []
  9318. }),
  9319. smalltalk.Symbol);
  9320. smalltalk.addMethod(
  9321. "_shallowCopy",
  9322. smalltalk.method({
  9323. selector: "shallowCopy",
  9324. category: 'copying',
  9325. fn: function (){
  9326. var self=this;
  9327. return self;
  9328. return self;},
  9329. args: [],
  9330. source: "shallowCopy\x0a\x09^self",
  9331. messageSends: [],
  9332. referencedClasses: []
  9333. }),
  9334. smalltalk.Symbol);
  9335. smalltalk.addMethod(
  9336. "_size",
  9337. smalltalk.method({
  9338. selector: "size",
  9339. category: 'accessing',
  9340. fn: function (){
  9341. var self=this;
  9342. return smalltalk.send(smalltalk.send(self, "_asString", []), "_size", []);
  9343. return self;},
  9344. args: [],
  9345. source: "size\x0a\x09^self asString size",
  9346. messageSends: ["size", "asString"],
  9347. referencedClasses: []
  9348. }),
  9349. smalltalk.Symbol);
  9350. smalltalk.addMethod(
  9351. "_basicNew",
  9352. smalltalk.method({
  9353. selector: "basicNew",
  9354. category: 'instance creation',
  9355. fn: function (){
  9356. var self=this;
  9357. smalltalk.send(self, "_shouldNotImplement", []);
  9358. return self;},
  9359. args: [],
  9360. source: "basicNew\x0a\x09self shouldNotImplement",
  9361. messageSends: ["shouldNotImplement"],
  9362. referencedClasses: []
  9363. }),
  9364. smalltalk.Symbol.klass);
  9365. smalltalk.addMethod(
  9366. "_fromString_",
  9367. smalltalk.method({
  9368. selector: "fromString:",
  9369. category: 'instance creation',
  9370. fn: function (aString){
  9371. var self=this;
  9372. return smalltalk.send(self, "_lookup_", [aString]);
  9373. return self;},
  9374. args: ["aString"],
  9375. source: "fromString: aString\x0a\x09^self lookup: aString",
  9376. messageSends: ["lookup:"],
  9377. referencedClasses: []
  9378. }),
  9379. smalltalk.Symbol.klass);
  9380. smalltalk.addMethod(
  9381. "_lookup_",
  9382. smalltalk.method({
  9383. selector: "lookup:",
  9384. category: 'instance creation',
  9385. fn: function (aString){
  9386. var self=this;
  9387. return smalltalk.symbolFor(aString);;
  9388. return self;},
  9389. args: ["aString"],
  9390. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  9391. messageSends: [],
  9392. referencedClasses: []
  9393. }),
  9394. smalltalk.Symbol.klass);
  9395. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  9396. smalltalk.addMethod(
  9397. "__eq",
  9398. smalltalk.method({
  9399. selector: "=",
  9400. category: 'comparing',
  9401. fn: function (aCollection){
  9402. var self=this;
  9403. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aCollection, "_class", [])]), "_and_", [(function(){return smalltalk.send(self['@elements'], "__eq", [smalltalk.send(aCollection, "_asArray", [])]);})]);
  9404. return self;},
  9405. args: ["aCollection"],
  9406. source: "= aCollection\x0a\x09^self class = aCollection class and: [\x0a\x09\x09elements = aCollection asArray]",
  9407. messageSends: ["and:", "=", "class", "asArray"],
  9408. referencedClasses: []
  9409. }),
  9410. smalltalk.Set);
  9411. smalltalk.addMethod(
  9412. "_add_",
  9413. smalltalk.method({
  9414. selector: "add:",
  9415. category: 'adding/removing',
  9416. fn: function (anObject){
  9417. var self=this;
  9418. var found;
  9419. for(var i=0; i < self['@elements'].length; i++) {
  9420. if(anObject == self['@elements'][i]) {
  9421. found = true;
  9422. break;
  9423. }
  9424. }
  9425. if(!found) {self['@elements'].push(anObject)}
  9426. ;
  9427. return self;},
  9428. args: ["anObject"],
  9429. 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>",
  9430. messageSends: [],
  9431. referencedClasses: []
  9432. }),
  9433. smalltalk.Set);
  9434. smalltalk.addMethod(
  9435. "_asArray",
  9436. smalltalk.method({
  9437. selector: "asArray",
  9438. category: 'converting',
  9439. fn: function (){
  9440. var self=this;
  9441. return smalltalk.send(self['@elements'], "_copy", []);
  9442. return self;},
  9443. args: [],
  9444. source: "asArray\x0a\x09^elements copy",
  9445. messageSends: ["copy"],
  9446. referencedClasses: []
  9447. }),
  9448. smalltalk.Set);
  9449. smalltalk.addMethod(
  9450. "_detect_ifNone_",
  9451. smalltalk.method({
  9452. selector: "detect:ifNone:",
  9453. category: 'enumerating',
  9454. fn: function (aBlock, anotherBlock){
  9455. var self=this;
  9456. return smalltalk.send(self['@elements'], "_detect_ifNone_", [aBlock, anotherBlock]);
  9457. return self;},
  9458. args: ["aBlock", "anotherBlock"],
  9459. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  9460. messageSends: ["detect:ifNone:"],
  9461. referencedClasses: []
  9462. }),
  9463. smalltalk.Set);
  9464. smalltalk.addMethod(
  9465. "_do_",
  9466. smalltalk.method({
  9467. selector: "do:",
  9468. category: 'enumerating',
  9469. fn: function (aBlock){
  9470. var self=this;
  9471. smalltalk.send(self['@elements'], "_do_", [aBlock]);
  9472. return self;},
  9473. args: ["aBlock"],
  9474. source: "do: aBlock\x0a\x09elements do: aBlock",
  9475. messageSends: ["do:"],
  9476. referencedClasses: []
  9477. }),
  9478. smalltalk.Set);
  9479. smalltalk.addMethod(
  9480. "_includes_",
  9481. smalltalk.method({
  9482. selector: "includes:",
  9483. category: 'testing',
  9484. fn: function (anObject){
  9485. var self=this;
  9486. return smalltalk.send(self['@elements'], "_includes_", [anObject]);
  9487. return self;},
  9488. args: ["anObject"],
  9489. source: "includes: anObject\x0a\x09^elements includes: anObject",
  9490. messageSends: ["includes:"],
  9491. referencedClasses: []
  9492. }),
  9493. smalltalk.Set);
  9494. smalltalk.addMethod(
  9495. "_initialize",
  9496. smalltalk.method({
  9497. selector: "initialize",
  9498. category: 'initialization',
  9499. fn: function (){
  9500. var self=this;
  9501. smalltalk.send(self, "_initialize", [], smalltalk.Set.superclass || nil);
  9502. (self['@elements']=[]);
  9503. return self;},
  9504. args: [],
  9505. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  9506. messageSends: ["initialize"],
  9507. referencedClasses: []
  9508. }),
  9509. smalltalk.Set);
  9510. smalltalk.addMethod(
  9511. "_remove_",
  9512. smalltalk.method({
  9513. selector: "remove:",
  9514. category: 'adding/removing',
  9515. fn: function (anObject){
  9516. var self=this;
  9517. smalltalk.send(self['@elements'], "_remove_", [anObject]);
  9518. return self;},
  9519. args: ["anObject"],
  9520. source: "remove: anObject\x0a\x09elements remove: anObject",
  9521. messageSends: ["remove:"],
  9522. referencedClasses: []
  9523. }),
  9524. smalltalk.Set);
  9525. smalltalk.addMethod(
  9526. "_select_",
  9527. smalltalk.method({
  9528. selector: "select:",
  9529. category: 'enumerating',
  9530. fn: function (aBlock){
  9531. var self=this;
  9532. var collection=nil;
  9533. (collection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  9534. smalltalk.send(self, "_do_", [(function(each){return ((($receiver = smalltalk.send(aBlock, "_value_", [each])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(collection, "_add_", [each]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(collection, "_add_", [each]);})]));})]);
  9535. return collection;
  9536. return self;},
  9537. args: ["aBlock"],
  9538. 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",
  9539. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"],
  9540. referencedClasses: []
  9541. }),
  9542. smalltalk.Set);
  9543. smalltalk.addMethod(
  9544. "_size",
  9545. smalltalk.method({
  9546. selector: "size",
  9547. category: 'accessing',
  9548. fn: function (){
  9549. var self=this;
  9550. return smalltalk.send(self['@elements'], "_size", []);
  9551. return self;},
  9552. args: [],
  9553. source: "size\x0a\x09^elements size",
  9554. messageSends: ["size"],
  9555. referencedClasses: []
  9556. }),
  9557. smalltalk.Set);
  9558. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  9559. smalltalk.addMethod(
  9560. "_compile_",
  9561. smalltalk.method({
  9562. selector: "compile:",
  9563. category: 'evaluating',
  9564. fn: function (aString){
  9565. var self=this;
  9566. return self.compile(aString);
  9567. return self;},
  9568. args: ["aString"],
  9569. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  9570. messageSends: [],
  9571. referencedClasses: []
  9572. }),
  9573. smalltalk.RegularExpression);
  9574. smalltalk.addMethod(
  9575. "_exec_",
  9576. smalltalk.method({
  9577. selector: "exec:",
  9578. category: 'evaluating',
  9579. fn: function (aString){
  9580. var self=this;
  9581. return self.exec(aString) || nil;
  9582. return self;},
  9583. args: ["aString"],
  9584. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  9585. messageSends: [],
  9586. referencedClasses: []
  9587. }),
  9588. smalltalk.RegularExpression);
  9589. smalltalk.addMethod(
  9590. "_test_",
  9591. smalltalk.method({
  9592. selector: "test:",
  9593. category: 'evaluating',
  9594. fn: function (aString){
  9595. var self=this;
  9596. return self.test(aString);
  9597. return self;},
  9598. args: ["aString"],
  9599. source: "test: aString\x0a\x09<return self.test(aString)>",
  9600. messageSends: [],
  9601. referencedClasses: []
  9602. }),
  9603. smalltalk.RegularExpression);
  9604. smalltalk.addMethod(
  9605. "_fromString_",
  9606. smalltalk.method({
  9607. selector: "fromString:",
  9608. category: 'instance creation',
  9609. fn: function (aString){
  9610. var self=this;
  9611. return smalltalk.send(self, "_fromString_flag_", [aString, ""]);
  9612. return self;},
  9613. args: ["aString"],
  9614. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  9615. messageSends: ["fromString:flag:"],
  9616. referencedClasses: []
  9617. }),
  9618. smalltalk.RegularExpression.klass);
  9619. smalltalk.addMethod(
  9620. "_fromString_flag_",
  9621. smalltalk.method({
  9622. selector: "fromString:flag:",
  9623. category: 'instance creation',
  9624. fn: function (aString, anotherString){
  9625. var self=this;
  9626. return new RegExp(aString, anotherString);
  9627. return self;},
  9628. args: ["aString", "anotherString"],
  9629. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  9630. messageSends: [],
  9631. referencedClasses: []
  9632. }),
  9633. smalltalk.RegularExpression.klass);
  9634. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  9635. smalltalk.addMethod(
  9636. "_atEnd",
  9637. smalltalk.method({
  9638. selector: "atEnd",
  9639. category: 'testing',
  9640. fn: function (){
  9641. var self=this;
  9642. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [smalltalk.send(self, "_size", [])]);
  9643. return self;},
  9644. args: [],
  9645. source: "atEnd\x0a\x09^self position = self size",
  9646. messageSends: ["=", "position", "size"],
  9647. referencedClasses: []
  9648. }),
  9649. smalltalk.Stream);
  9650. smalltalk.addMethod(
  9651. "_atStart",
  9652. smalltalk.method({
  9653. selector: "atStart",
  9654. category: 'testing',
  9655. fn: function (){
  9656. var self=this;
  9657. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [(0)]);
  9658. return self;},
  9659. args: [],
  9660. source: "atStart\x0a\x09^self position = 0",
  9661. messageSends: ["=", "position"],
  9662. referencedClasses: []
  9663. }),
  9664. smalltalk.Stream);
  9665. smalltalk.addMethod(
  9666. "_close",
  9667. smalltalk.method({
  9668. selector: "close",
  9669. category: 'actions',
  9670. fn: function (){
  9671. var self=this;
  9672. return self;},
  9673. args: [],
  9674. source: "close",
  9675. messageSends: [],
  9676. referencedClasses: []
  9677. }),
  9678. smalltalk.Stream);
  9679. smalltalk.addMethod(
  9680. "_collection",
  9681. smalltalk.method({
  9682. selector: "collection",
  9683. category: 'accessing',
  9684. fn: function (){
  9685. var self=this;
  9686. return self['@collection'];
  9687. return self;},
  9688. args: [],
  9689. source: "collection\x0a\x09^collection",
  9690. messageSends: [],
  9691. referencedClasses: []
  9692. }),
  9693. smalltalk.Stream);
  9694. smalltalk.addMethod(
  9695. "_contents",
  9696. smalltalk.method({
  9697. selector: "contents",
  9698. category: 'accessing',
  9699. fn: function (){
  9700. var self=this;
  9701. return smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_streamSize", [])]);
  9702. return self;},
  9703. args: [],
  9704. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  9705. messageSends: ["copyFrom:to:", "collection", "streamSize"],
  9706. referencedClasses: []
  9707. }),
  9708. smalltalk.Stream);
  9709. smalltalk.addMethod(
  9710. "_do_",
  9711. smalltalk.method({
  9712. selector: "do:",
  9713. category: 'enumerating',
  9714. fn: function (aBlock){
  9715. var self=this;
  9716. (function(){while(!(function(){return smalltalk.send(self, "_atEnd", []);})()) {(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_next", [])]);})()}})();
  9717. return self;},
  9718. args: ["aBlock"],
  9719. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  9720. messageSends: ["whileFalse:", "atEnd", "value:", "next"],
  9721. referencedClasses: []
  9722. }),
  9723. smalltalk.Stream);
  9724. smalltalk.addMethod(
  9725. "_flush",
  9726. smalltalk.method({
  9727. selector: "flush",
  9728. category: 'actions',
  9729. fn: function (){
  9730. var self=this;
  9731. return self;},
  9732. args: [],
  9733. source: "flush",
  9734. messageSends: [],
  9735. referencedClasses: []
  9736. }),
  9737. smalltalk.Stream);
  9738. smalltalk.addMethod(
  9739. "_isEmpty",
  9740. smalltalk.method({
  9741. selector: "isEmpty",
  9742. category: 'testing',
  9743. fn: function (){
  9744. var self=this;
  9745. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  9746. return self;},
  9747. args: [],
  9748. source: "isEmpty\x0a\x09^self size = 0",
  9749. messageSends: ["=", "size"],
  9750. referencedClasses: []
  9751. }),
  9752. smalltalk.Stream);
  9753. smalltalk.addMethod(
  9754. "_next",
  9755. smalltalk.method({
  9756. selector: "next",
  9757. category: 'reading',
  9758. fn: function (){
  9759. var self=this;
  9760. return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return nil;})() : (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return nil;}), (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})]));
  9761. return self;},
  9762. args: [],
  9763. 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]",
  9764. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"],
  9765. referencedClasses: []
  9766. }),
  9767. smalltalk.Stream);
  9768. smalltalk.addMethod(
  9769. "_next_",
  9770. smalltalk.method({
  9771. selector: "next:",
  9772. category: 'reading',
  9773. fn: function (anInteger){
  9774. var self=this;
  9775. var tempCollection=nil;
  9776. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  9777. smalltalk.send(anInteger, "_timesRepeat_", [(function(){return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(tempCollection, "_add_", [smalltalk.send(self, "_next", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(tempCollection, "_add_", [smalltalk.send(self, "_next", [])]);})]));})]);
  9778. return tempCollection;
  9779. return self;},
  9780. args: ["anInteger"],
  9781. 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",
  9782. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"],
  9783. referencedClasses: []
  9784. }),
  9785. smalltalk.Stream);
  9786. smalltalk.addMethod(
  9787. "_nextPut_",
  9788. smalltalk.method({
  9789. selector: "nextPut:",
  9790. category: 'writing',
  9791. fn: function (anObject){
  9792. var self=this;
  9793. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
  9794. smalltalk.send(smalltalk.send(self, "_collection", []), "_at_put_", [smalltalk.send(self, "_position", []), anObject]);
  9795. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  9796. return self;},
  9797. args: ["anObject"],
  9798. 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)",
  9799. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  9800. referencedClasses: []
  9801. }),
  9802. smalltalk.Stream);
  9803. smalltalk.addMethod(
  9804. "_nextPutAll_",
  9805. smalltalk.method({
  9806. selector: "nextPutAll:",
  9807. category: 'writing',
  9808. fn: function (aCollection){
  9809. var self=this;
  9810. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_nextPut_", [each]);})]);
  9811. return self;},
  9812. args: ["aCollection"],
  9813. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  9814. messageSends: ["do:", "nextPut:"],
  9815. referencedClasses: []
  9816. }),
  9817. smalltalk.Stream);
  9818. smalltalk.addMethod(
  9819. "_peek",
  9820. smalltalk.method({
  9821. selector: "peek",
  9822. category: 'reading',
  9823. fn: function (){
  9824. var self=this;
  9825. return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);})]));
  9826. return self;},
  9827. args: [],
  9828. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  9829. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"],
  9830. referencedClasses: []
  9831. }),
  9832. smalltalk.Stream);
  9833. smalltalk.addMethod(
  9834. "_position",
  9835. smalltalk.method({
  9836. selector: "position",
  9837. category: 'accessing',
  9838. fn: function (){
  9839. var self=this;
  9840. return (($receiver = self['@position']) == nil || $receiver == undefined) ? (function(){return (self['@position']=(0));})() : $receiver;
  9841. return self;},
  9842. args: [],
  9843. source: "position\x0a\x09^position ifNil: [position := 0]",
  9844. messageSends: ["ifNil:"],
  9845. referencedClasses: []
  9846. }),
  9847. smalltalk.Stream);
  9848. smalltalk.addMethod(
  9849. "_position_",
  9850. smalltalk.method({
  9851. selector: "position:",
  9852. category: 'accessing',
  9853. fn: function (anInteger){
  9854. var self=this;
  9855. (self['@position']=anInteger);
  9856. return self;},
  9857. args: ["anInteger"],
  9858. source: "position: anInteger\x0a\x09position := anInteger",
  9859. messageSends: [],
  9860. referencedClasses: []
  9861. }),
  9862. smalltalk.Stream);
  9863. smalltalk.addMethod(
  9864. "_reset",
  9865. smalltalk.method({
  9866. selector: "reset",
  9867. category: 'actions',
  9868. fn: function (){
  9869. var self=this;
  9870. smalltalk.send(self, "_position_", [(0)]);
  9871. return self;},
  9872. args: [],
  9873. source: "reset\x0a\x09self position: 0",
  9874. messageSends: ["position:"],
  9875. referencedClasses: []
  9876. }),
  9877. smalltalk.Stream);
  9878. smalltalk.addMethod(
  9879. "_resetContents",
  9880. smalltalk.method({
  9881. selector: "resetContents",
  9882. category: 'actions',
  9883. fn: function (){
  9884. var self=this;
  9885. smalltalk.send(self, "_reset", []);
  9886. smalltalk.send(self, "_setStreamSize_", [(0)]);
  9887. return self;},
  9888. args: [],
  9889. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  9890. messageSends: ["reset", "setStreamSize:"],
  9891. referencedClasses: []
  9892. }),
  9893. smalltalk.Stream);
  9894. smalltalk.addMethod(
  9895. "_setCollection_",
  9896. smalltalk.method({
  9897. selector: "setCollection:",
  9898. category: 'accessing',
  9899. fn: function (aCollection){
  9900. var self=this;
  9901. (self['@collection']=aCollection);
  9902. return self;},
  9903. args: ["aCollection"],
  9904. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  9905. messageSends: [],
  9906. referencedClasses: []
  9907. }),
  9908. smalltalk.Stream);
  9909. smalltalk.addMethod(
  9910. "_setStreamSize_",
  9911. smalltalk.method({
  9912. selector: "setStreamSize:",
  9913. category: 'accessing',
  9914. fn: function (anInteger){
  9915. var self=this;
  9916. (self['@streamSize']=anInteger);
  9917. return self;},
  9918. args: ["anInteger"],
  9919. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  9920. messageSends: [],
  9921. referencedClasses: []
  9922. }),
  9923. smalltalk.Stream);
  9924. smalltalk.addMethod(
  9925. "_setToEnd",
  9926. smalltalk.method({
  9927. selector: "setToEnd",
  9928. category: 'positioning',
  9929. fn: function (){
  9930. var self=this;
  9931. smalltalk.send(self, "_position_", [smalltalk.send(self, "_size", [])]);
  9932. return self;},
  9933. args: [],
  9934. source: "setToEnd\x0a\x09self position: self size",
  9935. messageSends: ["position:", "size"],
  9936. referencedClasses: []
  9937. }),
  9938. smalltalk.Stream);
  9939. smalltalk.addMethod(
  9940. "_size",
  9941. smalltalk.method({
  9942. selector: "size",
  9943. category: 'accessing',
  9944. fn: function (){
  9945. var self=this;
  9946. return smalltalk.send(self, "_streamSize", []);
  9947. return self;},
  9948. args: [],
  9949. source: "size\x0a\x09^self streamSize",
  9950. messageSends: ["streamSize"],
  9951. referencedClasses: []
  9952. }),
  9953. smalltalk.Stream);
  9954. smalltalk.addMethod(
  9955. "_skip_",
  9956. smalltalk.method({
  9957. selector: "skip:",
  9958. category: 'positioning',
  9959. fn: function (anInteger){
  9960. var self=this;
  9961. smalltalk.send(self, "_position_", [smalltalk.send(((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +anInteger : smalltalk.send($receiver, "__plus", [anInteger])), "_min_max_", [smalltalk.send(self, "_size", []), (0)])]);
  9962. return self;},
  9963. args: ["anInteger"],
  9964. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  9965. messageSends: ["position:", "min:max:", "+", "position", "size"],
  9966. referencedClasses: []
  9967. }),
  9968. smalltalk.Stream);
  9969. smalltalk.addMethod(
  9970. "_streamSize",
  9971. smalltalk.method({
  9972. selector: "streamSize",
  9973. category: 'accessing',
  9974. fn: function (){
  9975. var self=this;
  9976. return self['@streamSize'];
  9977. return self;},
  9978. args: [],
  9979. source: "streamSize\x0a\x09^streamSize",
  9980. messageSends: [],
  9981. referencedClasses: []
  9982. }),
  9983. smalltalk.Stream);
  9984. smalltalk.addMethod(
  9985. "_on_",
  9986. smalltalk.method({
  9987. selector: "on:",
  9988. category: 'instance creation',
  9989. fn: function (aCollection){
  9990. var self=this;
  9991. return (function($rec){smalltalk.send($rec, "_setCollection_", [aCollection]);smalltalk.send($rec, "_setStreamSize_", [smalltalk.send(aCollection, "_size", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  9992. return self;},
  9993. args: ["aCollection"],
  9994. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9995. messageSends: ["setCollection:", "setStreamSize:", "size", "yourself", "new"],
  9996. referencedClasses: []
  9997. }),
  9998. smalltalk.Stream.klass);
  9999. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  10000. smalltalk.addMethod(
  10001. "_cr",
  10002. smalltalk.method({
  10003. selector: "cr",
  10004. category: 'writing',
  10005. fn: function (){
  10006. var self=this;
  10007. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
  10008. return self;},
  10009. args: [],
  10010. source: "cr\x0a\x09^self nextPutAll: String cr",
  10011. messageSends: ["nextPutAll:", "cr"],
  10012. referencedClasses: ["String"]
  10013. }),
  10014. smalltalk.StringStream);
  10015. smalltalk.addMethod(
  10016. "_crlf",
  10017. smalltalk.method({
  10018. selector: "crlf",
  10019. category: 'writing',
  10020. fn: function (){
  10021. var self=this;
  10022. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_crlf", [])]);
  10023. return self;},
  10024. args: [],
  10025. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  10026. messageSends: ["nextPutAll:", "crlf"],
  10027. referencedClasses: ["String"]
  10028. }),
  10029. smalltalk.StringStream);
  10030. smalltalk.addMethod(
  10031. "_lf",
  10032. smalltalk.method({
  10033. selector: "lf",
  10034. category: 'writing',
  10035. fn: function (){
  10036. var self=this;
  10037. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_lf", [])]);
  10038. return self;},
  10039. args: [],
  10040. source: "lf\x0a\x09^self nextPutAll: String lf",
  10041. messageSends: ["nextPutAll:", "lf"],
  10042. referencedClasses: ["String"]
  10043. }),
  10044. smalltalk.StringStream);
  10045. smalltalk.addMethod(
  10046. "_next_",
  10047. smalltalk.method({
  10048. selector: "next:",
  10049. category: 'reading',
  10050. fn: function (anInteger){
  10051. var self=this;
  10052. var tempCollection=nil;
  10053. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  10054. smalltalk.send(anInteger, "_timesRepeat_", [(function(){return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (tempCollection=smalltalk.send(tempCollection, "__comma", [smalltalk.send(self, "_next", [])]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (tempCollection=smalltalk.send(tempCollection, "__comma", [smalltalk.send(self, "_next", [])]));})]));})]);
  10055. return tempCollection;
  10056. return self;},
  10057. args: ["anInteger"],
  10058. 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",
  10059. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"],
  10060. referencedClasses: []
  10061. }),
  10062. smalltalk.StringStream);
  10063. smalltalk.addMethod(
  10064. "_nextPut_",
  10065. smalltalk.method({
  10066. selector: "nextPut:",
  10067. category: 'writing',
  10068. fn: function (aString){
  10069. var self=this;
  10070. smalltalk.send(self, "_nextPutAll_", [aString]);
  10071. return self;},
  10072. args: ["aString"],
  10073. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  10074. messageSends: ["nextPutAll:"],
  10075. referencedClasses: []
  10076. }),
  10077. smalltalk.StringStream);
  10078. smalltalk.addMethod(
  10079. "_nextPutAll_",
  10080. smalltalk.method({
  10081. selector: "nextPutAll:",
  10082. category: 'writing',
  10083. fn: function (aString){
  10084. var self=this;
  10085. smalltalk.send(self, "_setCollection_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_position", [])]), "__comma", [aString]), "__comma", [smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [((($receiver = ((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))).klass === smalltalk.Number) ? $receiver +smalltalk.send(aString, "_size", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(aString, "_size", [])])), smalltalk.send(smalltalk.send(self, "_collection", []), "_size", [])])])]);
  10086. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(aString, "_size", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(aString, "_size", [])]))]);
  10087. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  10088. return self;},
  10089. args: ["aString"],
  10090. 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)",
  10091. messageSends: ["setCollection:", ",", "copyFrom:to:", "collection", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"],
  10092. referencedClasses: []
  10093. }),
  10094. smalltalk.StringStream);
  10095. smalltalk.addMethod(
  10096. "_space",
  10097. smalltalk.method({
  10098. selector: "space",
  10099. category: 'writing',
  10100. fn: function (){
  10101. var self=this;
  10102. smalltalk.send(self, "_nextPut_", [" "]);
  10103. return self;},
  10104. args: [],
  10105. source: "space\x0a\x09self nextPut: ' '",
  10106. messageSends: ["nextPut:"],
  10107. referencedClasses: []
  10108. }),
  10109. smalltalk.StringStream);
  10110. smalltalk.addPackage('Kernel-Exceptions', {});
  10111. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  10112. smalltalk.addMethod(
  10113. "_context",
  10114. smalltalk.method({
  10115. selector: "context",
  10116. category: 'accessing',
  10117. fn: function (){
  10118. var self=this;
  10119. return self.context;
  10120. return self;},
  10121. args: [],
  10122. source: "context\x0a\x09<return self.context>",
  10123. messageSends: [],
  10124. referencedClasses: []
  10125. }),
  10126. smalltalk.Error);
  10127. smalltalk.addMethod(
  10128. "_isSmalltalkError",
  10129. smalltalk.method({
  10130. selector: "isSmalltalkError",
  10131. category: 'testing',
  10132. fn: function (){
  10133. var self=this;
  10134. return self.smalltalkError === true;
  10135. return self;},
  10136. args: [],
  10137. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  10138. messageSends: [],
  10139. referencedClasses: []
  10140. }),
  10141. smalltalk.Error);
  10142. smalltalk.addMethod(
  10143. "_jsStack",
  10144. smalltalk.method({
  10145. selector: "jsStack",
  10146. category: 'accessing',
  10147. fn: function (){
  10148. var self=this;
  10149. return self.stack;
  10150. return self;},
  10151. args: [],
  10152. source: "jsStack\x0a\x09<return self.stack>",
  10153. messageSends: [],
  10154. referencedClasses: []
  10155. }),
  10156. smalltalk.Error);
  10157. smalltalk.addMethod(
  10158. "_messageText",
  10159. smalltalk.method({
  10160. selector: "messageText",
  10161. category: 'accessing',
  10162. fn: function (){
  10163. var self=this;
  10164. return self['@messageText'];
  10165. return self;},
  10166. args: [],
  10167. source: "messageText\x0a\x09^messageText",
  10168. messageSends: [],
  10169. referencedClasses: []
  10170. }),
  10171. smalltalk.Error);
  10172. smalltalk.addMethod(
  10173. "_messageText_",
  10174. smalltalk.method({
  10175. selector: "messageText:",
  10176. category: 'accessing',
  10177. fn: function (aString){
  10178. var self=this;
  10179. (self['@messageText']=aString);
  10180. return self;},
  10181. args: ["aString"],
  10182. source: "messageText: aString\x0a\x09messageText := aString",
  10183. messageSends: [],
  10184. referencedClasses: []
  10185. }),
  10186. smalltalk.Error);
  10187. smalltalk.addMethod(
  10188. "_signal",
  10189. smalltalk.method({
  10190. selector: "signal",
  10191. category: 'signaling',
  10192. fn: function (){
  10193. var self=this;
  10194. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  10195. return self;},
  10196. args: [],
  10197. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  10198. messageSends: [],
  10199. referencedClasses: []
  10200. }),
  10201. smalltalk.Error);
  10202. smalltalk.addMethod(
  10203. "_signal_",
  10204. smalltalk.method({
  10205. selector: "signal:",
  10206. category: 'signaling',
  10207. fn: function (aString){
  10208. var self=this;
  10209. smalltalk.send(self, "_messageText_", [aString]);
  10210. smalltalk.send(self, "_signal", []);
  10211. return self;},
  10212. args: ["aString"],
  10213. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  10214. messageSends: ["messageText:", "signal"],
  10215. referencedClasses: []
  10216. }),
  10217. smalltalk.Error);
  10218. smalltalk.addMethod(
  10219. "_signal",
  10220. smalltalk.method({
  10221. selector: "signal",
  10222. category: 'instance creation',
  10223. fn: function (){
  10224. var self=this;
  10225. return smalltalk.send(smalltalk.send(self, "_new", []), "_signal", []);
  10226. return self;},
  10227. args: [],
  10228. source: "signal\x0a\x09^self new signal",
  10229. messageSends: ["signal", "new"],
  10230. referencedClasses: []
  10231. }),
  10232. smalltalk.Error.klass);
  10233. smalltalk.addMethod(
  10234. "_signal_",
  10235. smalltalk.method({
  10236. selector: "signal:",
  10237. category: 'instance creation',
  10238. fn: function (aString){
  10239. var self=this;
  10240. return smalltalk.send(smalltalk.send(self, "_new", []), "_signal_", [aString]);
  10241. return self;},
  10242. args: ["aString"],
  10243. source: "signal: aString\x0a\x09 ^self new\x0a\x09\x09signal: aString",
  10244. messageSends: ["signal:", "new"],
  10245. referencedClasses: []
  10246. }),
  10247. smalltalk.Error.klass);
  10248. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  10249. smalltalk.addMethod(
  10250. "_message",
  10251. smalltalk.method({
  10252. selector: "message",
  10253. category: 'accessing',
  10254. fn: function (){
  10255. var self=this;
  10256. return self['@message'];
  10257. return self;},
  10258. args: [],
  10259. source: "message\x0a\x09^message",
  10260. messageSends: [],
  10261. referencedClasses: []
  10262. }),
  10263. smalltalk.MessageNotUnderstood);
  10264. smalltalk.addMethod(
  10265. "_message_",
  10266. smalltalk.method({
  10267. selector: "message:",
  10268. category: 'accessing',
  10269. fn: function (aMessage){
  10270. var self=this;
  10271. (self['@message']=aMessage);
  10272. return self;},
  10273. args: ["aMessage"],
  10274. source: "message: aMessage\x0a\x09message := aMessage",
  10275. messageSends: [],
  10276. referencedClasses: []
  10277. }),
  10278. smalltalk.MessageNotUnderstood);
  10279. smalltalk.addMethod(
  10280. "_messageText",
  10281. smalltalk.method({
  10282. selector: "messageText",
  10283. category: 'accessing',
  10284. fn: function (){
  10285. var self=this;
  10286. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_asString", []), "__comma", [" does not understand #"]), "__comma", [smalltalk.send(smalltalk.send(self, "_message", []), "_selector", [])]);
  10287. return self;},
  10288. args: [],
  10289. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  10290. messageSends: [",", "asString", "receiver", "selector", "message"],
  10291. referencedClasses: []
  10292. }),
  10293. smalltalk.MessageNotUnderstood);
  10294. smalltalk.addMethod(
  10295. "_receiver",
  10296. smalltalk.method({
  10297. selector: "receiver",
  10298. category: 'accessing',
  10299. fn: function (){
  10300. var self=this;
  10301. return self['@receiver'];
  10302. return self;},
  10303. args: [],
  10304. source: "receiver\x0a\x09^receiver",
  10305. messageSends: [],
  10306. referencedClasses: []
  10307. }),
  10308. smalltalk.MessageNotUnderstood);
  10309. smalltalk.addMethod(
  10310. "_receiver_",
  10311. smalltalk.method({
  10312. selector: "receiver:",
  10313. category: 'accessing',
  10314. fn: function (anObject){
  10315. var self=this;
  10316. (self['@receiver']=anObject);
  10317. return self;},
  10318. args: ["anObject"],
  10319. source: "receiver: anObject\x0a\x09receiver := anObject",
  10320. messageSends: [],
  10321. referencedClasses: []
  10322. }),
  10323. smalltalk.MessageNotUnderstood);
  10324. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  10325. smalltalk.addMethod(
  10326. "_handleError_",
  10327. smalltalk.method({
  10328. selector: "handleError:",
  10329. category: 'error handling',
  10330. fn: function (anError){
  10331. var self=this;
  10332. (($receiver = smalltalk.send(anError, "_context", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logErrorContext_", [smalltalk.send(anError, "_context", [])]);})() : nil;
  10333. smalltalk.send(self, "_logError_", [anError]);
  10334. return self;},
  10335. args: ["anError"],
  10336. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  10337. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"],
  10338. referencedClasses: []
  10339. }),
  10340. smalltalk.ErrorHandler);
  10341. smalltalk.addMethod(
  10342. "_log_",
  10343. smalltalk.method({
  10344. selector: "log:",
  10345. category: 'private',
  10346. fn: function (aString){
  10347. var self=this;
  10348. smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [aString]);
  10349. return self;},
  10350. args: ["aString"],
  10351. source: "log: aString\x0a\x09console log: aString",
  10352. messageSends: ["log:"],
  10353. referencedClasses: []
  10354. }),
  10355. smalltalk.ErrorHandler);
  10356. smalltalk.addMethod(
  10357. "_logContext_",
  10358. smalltalk.method({
  10359. selector: "logContext:",
  10360. category: 'private',
  10361. fn: function (aContext){
  10362. var self=this;
  10363. (($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;
  10364. smalltalk.send(self, "_log_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext, "_receiver", []), "_asString", []), "__comma", [">>"]), "__comma", [smalltalk.send(aContext, "_selector", [])])]);
  10365. return self;},
  10366. args: ["aContext"],
  10367. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector",
  10368. messageSends: ["ifNotNil:", "home", "logContext:", "log:", ",", "asString", "receiver", "selector"],
  10369. referencedClasses: []
  10370. }),
  10371. smalltalk.ErrorHandler);
  10372. smalltalk.addMethod(
  10373. "_logError_",
  10374. smalltalk.method({
  10375. selector: "logError:",
  10376. category: 'private',
  10377. fn: function (anError){
  10378. var self=this;
  10379. smalltalk.send(self, "_log_", [smalltalk.send(anError, "_messageText", [])]);
  10380. return self;},
  10381. args: ["anError"],
  10382. source: "logError: anError\x0a\x09self log: anError messageText",
  10383. messageSends: ["log:", "messageText"],
  10384. referencedClasses: []
  10385. }),
  10386. smalltalk.ErrorHandler);
  10387. smalltalk.addMethod(
  10388. "_logErrorContext_",
  10389. smalltalk.method({
  10390. selector: "logErrorContext:",
  10391. category: 'private',
  10392. fn: function (aContext){
  10393. var self=this;
  10394. (($receiver = aContext) != nil && $receiver != undefined) ? (function(){return (($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;})() : nil;
  10395. return self;},
  10396. args: ["aContext"],
  10397. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  10398. messageSends: ["ifNotNil:", "home", "logContext:"],
  10399. referencedClasses: []
  10400. }),
  10401. smalltalk.ErrorHandler);
  10402. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  10403. smalltalk.addMethod(
  10404. "_current",
  10405. smalltalk.method({
  10406. selector: "current",
  10407. category: 'accessing',
  10408. fn: function (){
  10409. var self=this;
  10410. return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return (self['@current']=smalltalk.send(self, "_new", []));})() : $receiver;
  10411. return self;},
  10412. args: [],
  10413. source: "current\x0a\x09^current ifNil: [current := self new]",
  10414. messageSends: ["ifNil:", "new"],
  10415. referencedClasses: []
  10416. }),
  10417. smalltalk.ErrorHandler.klass);
  10418. smalltalk.addMethod(
  10419. "_initialize",
  10420. smalltalk.method({
  10421. selector: "initialize",
  10422. category: 'initialization',
  10423. fn: function (){
  10424. var self=this;
  10425. smalltalk.send(self, "_register", []);
  10426. return self;},
  10427. args: [],
  10428. source: "initialize\x0a\x09self register",
  10429. messageSends: ["register"],
  10430. referencedClasses: []
  10431. }),
  10432. smalltalk.ErrorHandler.klass);
  10433. smalltalk.addMethod(
  10434. "_register",
  10435. smalltalk.method({
  10436. selector: "register",
  10437. category: 'initialization',
  10438. fn: function (){
  10439. var self=this;
  10440. smalltalk.send((smalltalk.ErrorHandler || ErrorHandler), "_setCurrent_", [smalltalk.send(self, "_new", [])]);
  10441. return self;},
  10442. args: [],
  10443. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  10444. messageSends: ["setCurrent:", "new"],
  10445. referencedClasses: ["ErrorHandler"]
  10446. }),
  10447. smalltalk.ErrorHandler.klass);
  10448. smalltalk.addMethod(
  10449. "_setCurrent_",
  10450. smalltalk.method({
  10451. selector: "setCurrent:",
  10452. category: 'accessing',
  10453. fn: function (anHandler){
  10454. var self=this;
  10455. (self['@current']=anHandler);
  10456. return self;},
  10457. args: ["anHandler"],
  10458. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  10459. messageSends: [],
  10460. referencedClasses: []
  10461. }),
  10462. smalltalk.ErrorHandler.klass);
  10463. smalltalk.addPackage('Kernel-Transcript', {});
  10464. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  10465. smalltalk.addMethod(
  10466. "_clear",
  10467. smalltalk.method({
  10468. selector: "clear",
  10469. category: 'printing',
  10470. fn: function (){
  10471. var self=this;
  10472. return self;},
  10473. args: [],
  10474. source: "clear\x0a\x09\x22no op\x22",
  10475. messageSends: [],
  10476. referencedClasses: []
  10477. }),
  10478. smalltalk.ConsoleTranscript);
  10479. smalltalk.addMethod(
  10480. "_cr",
  10481. smalltalk.method({
  10482. selector: "cr",
  10483. category: 'printing',
  10484. fn: function (){
  10485. var self=this;
  10486. return self;},
  10487. args: [],
  10488. source: "cr\x0a\x09\x22no op\x22",
  10489. messageSends: [],
  10490. referencedClasses: []
  10491. }),
  10492. smalltalk.ConsoleTranscript);
  10493. smalltalk.addMethod(
  10494. "_open",
  10495. smalltalk.method({
  10496. selector: "open",
  10497. category: 'actions',
  10498. fn: function (){
  10499. var self=this;
  10500. return self;},
  10501. args: [],
  10502. source: "open",
  10503. messageSends: [],
  10504. referencedClasses: []
  10505. }),
  10506. smalltalk.ConsoleTranscript);
  10507. smalltalk.addMethod(
  10508. "_show_",
  10509. smalltalk.method({
  10510. selector: "show:",
  10511. category: 'printing',
  10512. fn: function (anObject){
  10513. var self=this;
  10514. var string=nil;
  10515. (string=smalltalk.send(anObject, "_asString", []));
  10516. console.log(String(string));
  10517. return self;},
  10518. args: ["anObject"],
  10519. source: "show: anObject\x0a\x09| string |\x0a\x09string := anObject asString.\x0a\x09<console.log(String(string))>",
  10520. messageSends: ["asString"],
  10521. referencedClasses: []
  10522. }),
  10523. smalltalk.ConsoleTranscript);
  10524. smalltalk.addMethod(
  10525. "_initialize",
  10526. smalltalk.method({
  10527. selector: "initialize",
  10528. category: 'initialization',
  10529. fn: function (){
  10530. var self=this;
  10531. smalltalk.send((smalltalk.Transcript || Transcript), "_register_", [smalltalk.send(self, "_new", [])]);
  10532. return self;},
  10533. args: [],
  10534. source: "initialize\x0a\x09Transcript register: self new",
  10535. messageSends: ["register:", "new"],
  10536. referencedClasses: ["Transcript"]
  10537. }),
  10538. smalltalk.ConsoleTranscript.klass);
  10539. smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  10540. smalltalk.Transcript.klass.iVarNames = ['current'];
  10541. smalltalk.addMethod(
  10542. "_clear",
  10543. smalltalk.method({
  10544. selector: "clear",
  10545. category: 'printing',
  10546. fn: function (){
  10547. var self=this;
  10548. smalltalk.send(smalltalk.send(self, "_current", []), "_clear", []);
  10549. return self;},
  10550. args: [],
  10551. source: "clear\x0a self current clear",
  10552. messageSends: ["clear", "current"],
  10553. referencedClasses: []
  10554. }),
  10555. smalltalk.Transcript.klass);
  10556. smalltalk.addMethod(
  10557. "_cr",
  10558. smalltalk.method({
  10559. selector: "cr",
  10560. category: 'printing',
  10561. fn: function (){
  10562. var self=this;
  10563. smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
  10564. return self;},
  10565. args: [],
  10566. source: "cr\x0a self current show: String cr",
  10567. messageSends: ["show:", "current", "cr"],
  10568. referencedClasses: ["String"]
  10569. }),
  10570. smalltalk.Transcript.klass);
  10571. smalltalk.addMethod(
  10572. "_current",
  10573. smalltalk.method({
  10574. selector: "current",
  10575. category: 'instance creation',
  10576. fn: function (){
  10577. var self=this;
  10578. return self['@current'];
  10579. return self;},
  10580. args: [],
  10581. source: "current\x0a ^current",
  10582. messageSends: [],
  10583. referencedClasses: []
  10584. }),
  10585. smalltalk.Transcript.klass);
  10586. smalltalk.addMethod(
  10587. "_new",
  10588. smalltalk.method({
  10589. selector: "new",
  10590. category: 'instance creation',
  10591. fn: function (){
  10592. var self=this;
  10593. smalltalk.send(self, "_shouldNotImplement", []);
  10594. return self;},
  10595. args: [],
  10596. source: "new\x0a self shouldNotImplement",
  10597. messageSends: ["shouldNotImplement"],
  10598. referencedClasses: []
  10599. }),
  10600. smalltalk.Transcript.klass);
  10601. smalltalk.addMethod(
  10602. "_open",
  10603. smalltalk.method({
  10604. selector: "open",
  10605. category: 'instance creation',
  10606. fn: function (){
  10607. var self=this;
  10608. smalltalk.send(smalltalk.send(self, "_current", []), "_open", []);
  10609. return self;},
  10610. args: [],
  10611. source: "open\x0a self current open",
  10612. messageSends: ["open", "current"],
  10613. referencedClasses: []
  10614. }),
  10615. smalltalk.Transcript.klass);
  10616. smalltalk.addMethod(
  10617. "_register_",
  10618. smalltalk.method({
  10619. selector: "register:",
  10620. category: 'instance creation',
  10621. fn: function (aTranscript){
  10622. var self=this;
  10623. (self['@current']=aTranscript);
  10624. return self;},
  10625. args: ["aTranscript"],
  10626. source: "register: aTranscript\x0a\x09current := aTranscript",
  10627. messageSends: [],
  10628. referencedClasses: []
  10629. }),
  10630. smalltalk.Transcript.klass);
  10631. smalltalk.addMethod(
  10632. "_show_",
  10633. smalltalk.method({
  10634. selector: "show:",
  10635. category: 'printing',
  10636. fn: function (anObject){
  10637. var self=this;
  10638. smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [anObject]);
  10639. return self;},
  10640. args: ["anObject"],
  10641. source: "show: anObject\x0a self current show: anObject",
  10642. messageSends: ["show:", "current"],
  10643. referencedClasses: []
  10644. }),
  10645. smalltalk.Transcript.klass);
  10646. smalltalk.addPackage('FileServer', {});
  10647. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'port', 'basePath', 'util'], 'FileServer');
  10648. smalltalk.addMethod(
  10649. "_basePath",
  10650. smalltalk.method({
  10651. selector: "basePath",
  10652. category: 'accessing',
  10653. fn: function (){
  10654. var self=this;
  10655. return (($receiver = self['@basePath']) == nil || $receiver == undefined) ? (function(){return "./";})() : $receiver;
  10656. return self;},
  10657. args: [],
  10658. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  10659. messageSends: ["ifNil:"],
  10660. referencedClasses: []
  10661. }),
  10662. smalltalk.FileServer);
  10663. smalltalk.addMethod(
  10664. "_basePath_",
  10665. smalltalk.method({
  10666. selector: "basePath:",
  10667. category: 'accessing',
  10668. fn: function (aString){
  10669. var self=this;
  10670. (self['@basePath']=aString);
  10671. return self;},
  10672. args: ["aString"],
  10673. source: "basePath: aString\x0a\x09basePath := aString",
  10674. messageSends: [],
  10675. referencedClasses: []
  10676. }),
  10677. smalltalk.FileServer);
  10678. smalltalk.addMethod(
  10679. "_handleGETRequest_respondTo_",
  10680. smalltalk.method({
  10681. selector: "handleGETRequest:respondTo:",
  10682. category: 'request handling',
  10683. fn: function (aRequest, aResponse){
  10684. var self=this;
  10685. var uri=nil;
  10686. var filename=nil;
  10687. (uri=smalltalk.send(smalltalk.send(self['@url'], "_parse_", [smalltalk.send(aRequest, "_url", [])]), "_pathname", []));
  10688. (filename=smalltalk.send(self['@path'], "_join_with_", [smalltalk.send(self, "_basePath", []), uri]));
  10689. smalltalk.send(self['@path'], "_exists_do_", [filename, (function(boolean){return ((($receiver = boolean).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_respondNotFoundTo_", [aResponse]);})() : (function(){return smalltalk.send(self, "_respondFileNamed_to_", [filename, aResponse]);})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return smalltalk.send(self, "_respondNotFoundTo_", [aResponse]);}), (function(){return smalltalk.send(self, "_respondFileNamed_to_", [filename, aResponse]);})]));})]);
  10690. return self;},
  10691. args: ["aRequest", "aResponse"],
  10692. 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: [:boolean | \x0a\x09\x09boolean \x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
  10693. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  10694. referencedClasses: []
  10695. }),
  10696. smalltalk.FileServer);
  10697. smalltalk.addMethod(
  10698. "_handleOPTIONSRequest_respondTo_",
  10699. smalltalk.method({
  10700. selector: "handleOPTIONSRequest:respondTo:",
  10701. category: 'request handling',
  10702. fn: function (aRequest, aResponse){
  10703. var self=this;
  10704. smalltalk.send(aResponse, "_writeHead_options_", [(200), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Access-Control-Allow-Origin", "__minus_gt", ["*"]),smalltalk.send("Access-Control-Allow-Methods", "__minus_gt", ["GET, PUT, POST, DELETE, OPTIONS"]),smalltalk.send("Access-Control-Allow-Headers", "__minus_gt", ["Content-Type, Accept"]),smalltalk.send("Content-Length", "__minus_gt", [(0)]),smalltalk.send("Access-Control-Max-Age", "__minus_gt", [(10)])])]);
  10705. smalltalk.send(aResponse, "_end", []);
  10706. return self;},
  10707. args: ["aRequest", "aResponse"],
  10708. 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",
  10709. messageSends: ["writeHead:options:", "->", "end"],
  10710. referencedClasses: []
  10711. }),
  10712. smalltalk.FileServer);
  10713. smalltalk.addMethod(
  10714. "_handlePUTRequest_respondTo_",
  10715. smalltalk.method({
  10716. selector: "handlePUTRequest:respondTo:",
  10717. category: 'request handling',
  10718. fn: function (aRequest, aResponse){
  10719. var self=this;
  10720. var stream=nil;
  10721. (stream=smalltalk.send(self['@fs'], "_createWriteStream_", [smalltalk.send(".", "__comma", [smalltalk.send(aRequest, "_url", [])])]));
  10722. smalltalk.send(aRequest, "_setEncoding_", ["utf8"]);
  10723. smalltalk.send(aRequest, "_on_do_", ["data", (function(data){return smalltalk.send(stream, "_write_", [data]);})]);
  10724. smalltalk.send(aRequest, "_on_do_", ["end", (function(){smalltalk.send(stream, "_end", []);return smalltalk.send(self, "_respondOKTo_", [aResponse]);})]);
  10725. return self;},
  10726. args: ["aRequest", "aResponse"],
  10727. source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09|stream |\x0a\x09stream := fs createWriteStream: '.' , aRequest url.\x0a aRequest setEncoding: 'utf8'.\x0a aRequest on: 'data' do: [:data | stream write: data].\x0a\x0a aRequest on: 'end' do: [\x0a stream end.\x0a self respondOKTo: aResponse]",
  10728. messageSends: ["createWriteStream:", ",", "url", "setEncoding:", "on:do:", "write:", "end", "respondOKTo:"],
  10729. referencedClasses: []
  10730. }),
  10731. smalltalk.FileServer);
  10732. smalltalk.addMethod(
  10733. "_handleRequest_respondTo_",
  10734. smalltalk.method({
  10735. selector: "handleRequest:respondTo:",
  10736. category: 'request handling',
  10737. fn: function (aRequest, aResponse){
  10738. var self=this;
  10739. ((($receiver = smalltalk.send(smalltalk.send(aRequest, "_method", []), "__eq", ["PUT"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_handlePUTRequest_respondTo_", [aRequest, aResponse]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_handlePUTRequest_respondTo_", [aRequest, aResponse]);})]));
  10740. ((($receiver = smalltalk.send(smalltalk.send(aRequest, "_method", []), "__eq", ["GET"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_handleGETRequest_respondTo_", [aRequest, aResponse]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_handleGETRequest_respondTo_", [aRequest, aResponse]);})]));
  10741. ((($receiver = smalltalk.send(smalltalk.send(aRequest, "_method", []), "__eq", ["OPTIONS"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_handleOPTIONSRequest_respondTo_", [aRequest, aResponse]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_handleOPTIONSRequest_respondTo_", [aRequest, aResponse]);})]));
  10742. return self;},
  10743. args: ["aRequest", "aResponse"],
  10744. source: "handleRequest: aRequest respondTo: aResponse\x0a\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]",
  10745. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  10746. referencedClasses: []
  10747. }),
  10748. smalltalk.FileServer);
  10749. smalltalk.addMethod(
  10750. "_initialize",
  10751. smalltalk.method({
  10752. selector: "initialize",
  10753. category: 'initialization',
  10754. fn: function (){
  10755. var self=this;
  10756. smalltalk.send(self, "_initialize", [], smalltalk.FileServer.superclass || nil);
  10757. (self['@path']=smalltalk.send(self, "_require_", ["path"]));
  10758. (self['@http']=smalltalk.send(self, "_require_", ["http"]));
  10759. (self['@fs']=smalltalk.send(self, "_require_", ["fs"]));
  10760. (self['@util']=smalltalk.send(self, "_require_", ["util"]));
  10761. (self['@url']=smalltalk.send(self, "_require_", ["url"]));
  10762. return self;},
  10763. args: [],
  10764. 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'",
  10765. messageSends: ["initialize", "require:"],
  10766. referencedClasses: []
  10767. }),
  10768. smalltalk.FileServer);
  10769. smalltalk.addMethod(
  10770. "_port",
  10771. smalltalk.method({
  10772. selector: "port",
  10773. category: 'accessing',
  10774. fn: function (){
  10775. var self=this;
  10776. return smalltalk.send(smalltalk.send(self, "_class", []), "_port", []);
  10777. return self;},
  10778. args: [],
  10779. source: "port\x0a\x09^self class port",
  10780. messageSends: ["port", "class"],
  10781. referencedClasses: []
  10782. }),
  10783. smalltalk.FileServer);
  10784. smalltalk.addMethod(
  10785. "_require_",
  10786. smalltalk.method({
  10787. selector: "require:",
  10788. category: 'private',
  10789. fn: function (aModuleString){
  10790. var self=this;
  10791. return smalltalk.send((typeof require == 'undefined' ? nil : require), "_value_", [aModuleString]);
  10792. return self;},
  10793. args: ["aModuleString"],
  10794. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  10795. messageSends: ["value:"],
  10796. referencedClasses: []
  10797. }),
  10798. smalltalk.FileServer);
  10799. smalltalk.addMethod(
  10800. "_respondFileNamed_to_",
  10801. smalltalk.method({
  10802. selector: "respondFileNamed:to:",
  10803. category: 'request handling',
  10804. fn: function (aFilename, aResponse){
  10805. var self=this;
  10806. var type=nil;
  10807. var filename=nil;
  10808. (filename=aFilename);
  10809. ((($receiver = smalltalk.send(smalltalk.send(self['@fs'], "_statSync_", [aFilename]), "_isDirectory", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (filename=smalltalk.send(filename, "__comma", ["index.html"]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (filename=smalltalk.send(filename, "__comma", ["index.html"]));})]));
  10810. smalltalk.send(self['@fs'], "_readFile_do_", [filename, (function(ex, file){return ((($receiver = smalltalk.send(ex, "_notNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_respondInternalErrorTo_", [aResponse]);})() : (function(){(type=smalltalk.send(smalltalk.send(self, "_class", []), "_mimeTypeFor_", [filename]));((($receiver = smalltalk.send(type, "__eq", ["application/javascript"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (type=smalltalk.send(type, "__comma", [";charset=utf-8"]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (type=smalltalk.send(type, "__comma", [";charset=utf-8"]));})]));return (function($rec){smalltalk.send($rec, "_writeHead_options_", [(200), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", [type])])]);smalltalk.send($rec, "_write_encoding_", [file, "binary"]);return smalltalk.send($rec, "_end", []);})(aResponse);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_respondInternalErrorTo_", [aResponse]);}), (function(){(type=smalltalk.send(smalltalk.send(self, "_class", []), "_mimeTypeFor_", [filename]));((($receiver = smalltalk.send(type, "__eq", ["application/javascript"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (type=smalltalk.send(type, "__comma", [";charset=utf-8"]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (type=smalltalk.send(type, "__comma", [";charset=utf-8"]));})]));return (function($rec){smalltalk.send($rec, "_writeHead_options_", [(200), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", [type])])]);smalltalk.send($rec, "_write_encoding_", [file, "binary"]);return smalltalk.send($rec, "_end", []);})(aResponse);})]));})]);
  10811. return self;},
  10812. args: ["aFilename", "aResponse"],
  10813. 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: [self 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]]",
  10814. messageSends: ["ifTrue:", "isDirectory", "statSync:", ",", "readFile:do:", "ifTrue:ifFalse:", "notNil", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end"],
  10815. referencedClasses: []
  10816. }),
  10817. smalltalk.FileServer);
  10818. smalltalk.addMethod(
  10819. "_respondInternalErrorTo_",
  10820. smalltalk.method({
  10821. selector: "respondInternalErrorTo:",
  10822. category: 'request handling',
  10823. fn: function (aResponse){
  10824. var self=this;
  10825. (function($rec){smalltalk.send($rec, "_writeHead_options_", [(500), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", ["text/plain"])])]);smalltalk.send($rec, "_write_", ["500 Internal server error"]);return smalltalk.send($rec, "_end", []);})(aResponse);
  10826. return self;},
  10827. args: ["aResponse"],
  10828. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  10829. messageSends: ["writeHead:options:", "->", "write:", "end"],
  10830. referencedClasses: []
  10831. }),
  10832. smalltalk.FileServer);
  10833. smalltalk.addMethod(
  10834. "_respondNotFoundTo_",
  10835. smalltalk.method({
  10836. selector: "respondNotFoundTo:",
  10837. category: 'request handling',
  10838. fn: function (aResponse){
  10839. var self=this;
  10840. (function($rec){smalltalk.send($rec, "_writeHead_options_", [(404), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", ["text/plain"])])]);smalltalk.send($rec, "_write_", ["404 Not found"]);return smalltalk.send($rec, "_end", []);})(aResponse);
  10841. return self;},
  10842. args: ["aResponse"],
  10843. source: "respondNotFoundTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
  10844. messageSends: ["writeHead:options:", "->", "write:", "end"],
  10845. referencedClasses: []
  10846. }),
  10847. smalltalk.FileServer);
  10848. smalltalk.addMethod(
  10849. "_respondOKTo_",
  10850. smalltalk.method({
  10851. selector: "respondOKTo:",
  10852. category: 'request handling',
  10853. fn: function (aResponse){
  10854. var self=this;
  10855. smalltalk.send(aResponse, "_writeHead_options_", [(200), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", ["text/plain"]),smalltalk.send("Access-Control-Allow-Origin", "__minus_gt", ["*"])])]);
  10856. smalltalk.send(aResponse, "_end", []);
  10857. return self;},
  10858. args: ["aResponse"],
  10859. source: "respondOKTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'}.\x0a\x09aResponse end.",
  10860. messageSends: ["writeHead:options:", "->", "end"],
  10861. referencedClasses: []
  10862. }),
  10863. smalltalk.FileServer);
  10864. smalltalk.addMethod(
  10865. "_start",
  10866. smalltalk.method({
  10867. selector: "start",
  10868. category: 'starting',
  10869. fn: function (){
  10870. var self=this;
  10871. smalltalk.send(smalltalk.send(self['@http'], "_createServer_", [(function(request, response){return smalltalk.send(self, "_handleRequest_respondTo_", [request, response]);})]), "_listen_", [smalltalk.send(self, "_port", [])]);
  10872. smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send("Starting file server on port ", "__comma", [smalltalk.send(smalltalk.send(self, "_port", []), "_asString", [])])]);
  10873. return self;},
  10874. args: [],
  10875. source: "start\x0a\x09(http createServer: [:request :response |\x0a\x09 \x09self handleRequest: request respondTo: response]) listen: self port.\x0a\x09console log: 'Starting file server on port ', self port asString",
  10876. messageSends: ["listen:", "createServer:", "handleRequest:respondTo:", "port", "log:", ",", "asString"],
  10877. referencedClasses: []
  10878. }),
  10879. smalltalk.FileServer);
  10880. smalltalk.addMethod(
  10881. "_startOn_",
  10882. smalltalk.method({
  10883. selector: "startOn:",
  10884. category: 'starting',
  10885. fn: function (aPort){
  10886. var self=this;
  10887. (self['@port']=aPort);
  10888. smalltalk.send(self, "_start", []);
  10889. return self;},
  10890. args: ["aPort"],
  10891. source: "startOn: aPort\x0a\x09port := aPort.\x0a\x09self start",
  10892. messageSends: ["start"],
  10893. referencedClasses: []
  10894. }),
  10895. smalltalk.FileServer);
  10896. smalltalk.addMethod(
  10897. "_writeData_toFileNamed_",
  10898. smalltalk.method({
  10899. selector: "writeData:toFileNamed:",
  10900. category: 'private',
  10901. fn: function (data, aFilename){
  10902. var self=this;
  10903. smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [aFilename]);
  10904. return self;},
  10905. args: ["data", "aFilename"],
  10906. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  10907. messageSends: ["log:"],
  10908. referencedClasses: []
  10909. }),
  10910. smalltalk.FileServer);
  10911. smalltalk.FileServer.klass.iVarNames = ['port','mimeTypes'];
  10912. smalltalk.addMethod(
  10913. "_defaultMimeTypes",
  10914. smalltalk.method({
  10915. selector: "defaultMimeTypes",
  10916. category: 'accessing',
  10917. fn: function (){
  10918. var self=this;
  10919. return smalltalk.HashedCollection._fromPairs_([smalltalk.send("%", "__minus_gt", ["application/x-trash"]),smalltalk.send("323", "__minus_gt", ["text/h323"]),smalltalk.send("abw", "__minus_gt", ["application/x-abiword"]),smalltalk.send("ai", "__minus_gt", ["application/postscript"]),smalltalk.send("aif", "__minus_gt", ["audio/x-aiff"]),smalltalk.send("aifc", "__minus_gt", ["audio/x-aiff"]),smalltalk.send("aiff", "__minus_gt", ["audio/x-aiff"]),smalltalk.send("alc", "__minus_gt", ["chemical/x-alchemy"]),smalltalk.send("art", "__minus_gt", ["image/x-jg"]),smalltalk.send("asc", "__minus_gt", ["text/plain"]),smalltalk.send("asf", "__minus_gt", ["video/x-ms-asf"]),smalltalk.send("asn", "__minus_gt", ["chemical/x-ncbi-asn1-spec"]),smalltalk.send("aso", "__minus_gt", ["chemical/x-ncbi-asn1-binary"]),smalltalk.send("asx", "__minus_gt", ["video/x-ms-asf"]),smalltalk.send("au", "__minus_gt", ["audio/basic"]),smalltalk.send("avi", "__minus_gt", ["video/x-msvideo"]),smalltalk.send("b", "__minus_gt", ["chemical/x-molconn-Z"]),smalltalk.send("bak", "__minus_gt", ["application/x-trash"]),smalltalk.send("bat", "__minus_gt", ["application/x-msdos-program"]),smalltalk.send("bcpio", "__minus_gt", ["application/x-bcpio"]),smalltalk.send("bib", "__minus_gt", ["text/x-bibtex"]),smalltalk.send("bin", "__minus_gt", ["application/octet-stream"]),smalltalk.send("bmp", "__minus_gt", ["image/x-ms-bmp"]),smalltalk.send("book", "__minus_gt", ["application/x-maker"]),smalltalk.send("bsd", "__minus_gt", ["chemical/x-crossfire"]),smalltalk.send("c", "__minus_gt", ["text/x-csrc"]),smalltalk.send("c++", "__minus_gt", ["text/x-c++src"]),smalltalk.send("c3d", "__minus_gt", ["chemical/x-chem3d"]),smalltalk.send("cac", "__minus_gt", ["chemical/x-cache"]),smalltalk.send("cache", "__minus_gt", ["chemical/x-cache"]),smalltalk.send("cascii", "__minus_gt", ["chemical/x-cactvs-binary"]),smalltalk.send("cat", "__minus_gt", ["application/vnd.ms-pki.seccat"]),smalltalk.send("cbin", "__minus_gt", ["chemical/x-cactvs-binary"]),smalltalk.send("cc", "__minus_gt", ["text/x-c++src"]),smalltalk.send("cdf", "__minus_gt", ["application/x-cdf"]),smalltalk.send("cdr", "__minus_gt", ["image/x-coreldraw"]),smalltalk.send("cdt", "__minus_gt", ["image/x-coreldrawtemplate"]),smalltalk.send("cdx", "__minus_gt", ["chemical/x-cdx"]),smalltalk.send("cdy", "__minus_gt", ["application/vnd.cinderella"]),smalltalk.send("cef", "__minus_gt", ["chemical/x-cxf"]),smalltalk.send("cer", "__minus_gt", ["chemical/x-cerius"]),smalltalk.send("chm", "__minus_gt", ["chemical/x-chemdraw"]),smalltalk.send("chrt", "__minus_gt", ["application/x-kchart"]),smalltalk.send("cif", "__minus_gt", ["chemical/x-cif"]),smalltalk.send("class", "__minus_gt", ["application/java-vm"]),smalltalk.send("cls", "__minus_gt", ["text/x-tex"]),smalltalk.send("cmdf", "__minus_gt", ["chemical/x-cmdf"]),smalltalk.send("cml", "__minus_gt", ["chemical/x-cml"]),smalltalk.send("cod", "__minus_gt", ["application/vnd.rim.cod"]),smalltalk.send("com", "__minus_gt", ["application/x-msdos-program"]),smalltalk.send("cpa", "__minus_gt", ["chemical/x-compass"]),smalltalk.send("cpio", "__minus_gt", ["application/x-cpio"]),smalltalk.send("cpp", "__minus_gt", ["text/x-c++src"]),smalltalk.send("cpt", "__minus_gt", ["image/x-corelphotopaint"]),smalltalk.send("crl", "__minus_gt", ["application/x-pkcs7-crl"]),smalltalk.send("crt", "__minus_gt", ["application/x-x509-ca-cert"]),smalltalk.send("csf", "__minus_gt", ["chemical/x-cache-csf"]),smalltalk.send("csh", "__minus_gt", ["text/x-csh"]),smalltalk.send("csm", "__minus_gt", ["chemical/x-csml"]),smalltalk.send("csml", "__minus_gt", ["chemical/x-csml"]),smalltalk.send("css", "__minus_gt", ["text/css"]),smalltalk.send("csv", "__minus_gt", ["text/comma-separated-values"]),smalltalk.send("ctab", "__minus_gt", ["chemical/x-cactvs-binary"]),smalltalk.send("ctx", "__minus_gt", ["chemical/x-ctx"]),smalltalk.send("cu", "__minus_gt", ["application/cu-seeme"]),smalltalk.send("cub", "__minus_gt", ["chemical/x-gaussian-cube"]),smalltalk.send("cxf", "__minus_gt", ["chemical/x-cxf"]),smalltalk.send("cxx", "__minus_gt", ["text/x-c++src"]),smalltalk.send("dat", "__minus_gt", ["chemical/x-mopac-input"]),smalltalk.send("dcr", "__minus_gt", ["application/x-director"]),smalltalk.send("deb", "__minus_gt", ["application/x-debian-package"]),smalltalk.send("dif", "__minus_gt", ["video/dv"]),smalltalk.send("diff", "__minus_gt", ["text/plain"]),smalltalk.send("dir", "__minus_gt", ["application/x-director"]),smalltalk.send("djv", "__minus_gt", ["image/vnd.djvu"]),smalltalk.send("djvu", "__minus_gt", ["image/vnd.djvu"]),smalltalk.send("dl", "__minus_gt", ["video/dl"]),smalltalk.send("dll", "__minus_gt", ["application/x-msdos-program"]),smalltalk.send("dmg", "__minus_gt", ["application/x-apple-diskimage"]),smalltalk.send("dms", "__minus_gt", ["application/x-dms"]),smalltalk.send("doc", "__minus_gt", ["application/msword"]),smalltalk.send("dot", "__minus_gt", ["application/msword"]),smalltalk.send("dv", "__minus_gt", ["video/dv"]),smalltalk.send("dvi", "__minus_gt", ["application/x-dvi"]),smalltalk.send("dx", "__minus_gt", ["chemical/x-jcamp-dx"]),smalltalk.send("dxr", "__minus_gt", ["application/x-director"]),smalltalk.send("emb", "__minus_gt", ["chemical/x-embl-dl-nucleotide"]),smalltalk.send("embl", "__minus_gt", ["chemical/x-embl-dl-nucleotide"]),smalltalk.send("ent", "__minus_gt", ["chemical/x-pdb"]),smalltalk.send("eps", "__minus_gt", ["application/postscript"]),smalltalk.send("etx", "__minus_gt", ["text/x-setext"]),smalltalk.send("exe", "__minus_gt", ["application/x-msdos-program"]),smalltalk.send("ez", "__minus_gt", ["application/andrew-inset"]),smalltalk.send("fb", "__minus_gt", ["application/x-maker"]),smalltalk.send("fbdoc", "__minus_gt", ["application/x-maker"]),smalltalk.send("fch", "__minus_gt", ["chemical/x-gaussian-checkpoint"]),smalltalk.send("fchk", "__minus_gt", ["chemical/x-gaussian-checkpoint"]),smalltalk.send("fig", "__minus_gt", ["application/x-xfig"]),smalltalk.send("flac", "__minus_gt", ["application/x-flac"]),smalltalk.send("fli", "__minus_gt", ["video/fli"]),smalltalk.send("fm", "__minus_gt", ["application/x-maker"]),smalltalk.send("frame", "__minus_gt", ["application/x-maker"]),smalltalk.send("frm", "__minus_gt", ["application/x-maker"]),smalltalk.send("gal", "__minus_gt", ["chemical/x-gaussian-log"]),smalltalk.send("gam", "__minus_gt", ["chemical/x-gamess-input"]),smalltalk.send("gamin", "__minus_gt", ["chemical/x-gamess-input"]),smalltalk.send("gau", "__minus_gt", ["chemical/x-gaussian-input"]),smalltalk.send("gcd", "__minus_gt", ["text/x-pcs-gcd"]),smalltalk.send("gcf", "__minus_gt", ["application/x-graphing-calculator"]),smalltalk.send("gcg", "__minus_gt", ["chemical/x-gcg8-sequence"]),smalltalk.send("gen", "__minus_gt", ["chemical/x-genbank"]),smalltalk.send("gf", "__minus_gt", ["application/x-tex-gf"]),smalltalk.send("gif", "__minus_gt", ["image/gif"]),smalltalk.send("gjc", "__minus_gt", ["chemical/x-gaussian-input"]),smalltalk.send("gjf", "__minus_gt", ["chemical/x-gaussian-input"]),smalltalk.send("gl", "__minus_gt", ["video/gl"]),smalltalk.send("gnumeric", "__minus_gt", ["application/x-gnumeric"]),smalltalk.send("gpt", "__minus_gt", ["chemical/x-mopac-graph"]),smalltalk.send("gsf", "__minus_gt", ["application/x-font"]),smalltalk.send("gsm", "__minus_gt", ["audio/x-gsm"]),smalltalk.send("gtar", "__minus_gt", ["application/x-gtar"]),smalltalk.send("h", "__minus_gt", ["text/x-chdr"]),smalltalk.send("h++", "__minus_gt", ["text/x-c++hdr"]),smalltalk.send("hdf", "__minus_gt", ["application/x-hdf"]),smalltalk.send("hh", "__minus_gt", ["text/x-c++hdr"]),smalltalk.send("hin", "__minus_gt", ["chemical/x-hin"]),smalltalk.send("hpp", "__minus_gt", ["text/x-c++hdr"]),smalltalk.send("hqx", "__minus_gt", ["application/mac-binhex40"]),smalltalk.send("hs", "__minus_gt", ["text/x-haskell"]),smalltalk.send("hta", "__minus_gt", ["application/hta"]),smalltalk.send("htc", "__minus_gt", ["text/x-component"]),smalltalk.send("htm", "__minus_gt", ["text/html"]),smalltalk.send("html", "__minus_gt", ["text/html"]),smalltalk.send("hxx", "__minus_gt", ["text/x-c++hdr"]),smalltalk.send("ica", "__minus_gt", ["application/x-ica"]),smalltalk.send("ice", "__minus_gt", ["x-conference/x-cooltalk"]),smalltalk.send("ico", "__minus_gt", ["image/x-icon"]),smalltalk.send("ics", "__minus_gt", ["text/calendar"]),smalltalk.send("icz", "__minus_gt", ["text/calendar"]),smalltalk.send("ief", "__minus_gt", ["image/ief"]),smalltalk.send("iges", "__minus_gt", ["model/iges"]),smalltalk.send("igs", "__minus_gt", ["model/iges"]),smalltalk.send("iii", "__minus_gt", ["application/x-iphone"]),smalltalk.send("inp", "__minus_gt", ["chemical/x-gamess-input"]),smalltalk.send("ins", "__minus_gt", ["application/x-internet-signup"]),smalltalk.send("iso", "__minus_gt", ["application/x-iso9660-image"]),smalltalk.send("isp", "__minus_gt", ["application/x-internet-signup"]),smalltalk.send("ist", "__minus_gt", ["chemical/x-isostar"]),smalltalk.send("istr", "__minus_gt", ["chemical/x-isostar"]),smalltalk.send("jad", "__minus_gt", ["text/vnd.sun.j2me.app-descriptor"]),smalltalk.send("jar", "__minus_gt", ["application/java-archive"]),smalltalk.send("java", "__minus_gt", ["text/x-java"]),smalltalk.send("jdx", "__minus_gt", ["chemical/x-jcamp-dx"]),smalltalk.send("jmz", "__minus_gt", ["application/x-jmol"]),smalltalk.send("jng", "__minus_gt", ["image/x-jng"]),smalltalk.send("jnlp", "__minus_gt", ["application/x-java-jnlp-file"]),smalltalk.send("jpe", "__minus_gt", ["image/jpeg"]),smalltalk.send("jpeg", "__minus_gt", ["image/jpeg"]),smalltalk.send("jpg", "__minus_gt", ["image/jpeg"]),smalltalk.send("js", "__minus_gt", ["application/javascript"]),smalltalk.send("kar", "__minus_gt", ["audio/midi"]),smalltalk.send("key", "__minus_gt", ["application/pgp-keys"]),smalltalk.send("kil", "__minus_gt", ["application/x-killustrator"]),smalltalk.send("kin", "__minus_gt", ["chemical/x-kinemage"]),smalltalk.send("kpr", "__minus_gt", ["application/x-kpresenter"]),smalltalk.send("kpt", "__minus_gt", ["application/x-kpresenter"]),smalltalk.send("ksp", "__minus_gt", ["application/x-kspread"]),smalltalk.send("kwd", "__minus_gt", ["application/x-kword"]),smalltalk.send("kwt", "__minus_gt", ["application/x-kword"]),smalltalk.send("latex", "__minus_gt", ["application/x-latex"]),smalltalk.send("lha", "__minus_gt", ["application/x-lha"]),smalltalk.send("lhs", "__minus_gt", ["text/x-literate-haskell"]),smalltalk.send("lsf", "__minus_gt", ["video/x-la-asf"]),smalltalk.send("lsx", "__minus_gt", ["video/x-la-asf"]),smalltalk.send("ltx", "__minus_gt", ["text/x-tex"]),smalltalk.send("lzh", "__minus_gt", ["application/x-lzh"]),smalltalk.send("lzx", "__minus_gt", ["application/x-lzx"]),smalltalk.send("m3u", "__minus_gt", ["audio/x-mpegurl"]),smalltalk.send("m4a", "__minus_gt", ["audio/mpeg"]),smalltalk.send("maker", "__minus_gt", ["application/x-maker"]),smalltalk.send("man", "__minus_gt", ["application/x-troff-man"]),smalltalk.send("mcif", "__minus_gt", ["chemical/x-mmcif"]),smalltalk.send("mcm", "__minus_gt", ["chemical/x-macmolecule"]),smalltalk.send("mdb", "__minus_gt", ["application/msaccess"]),smalltalk.send("me", "__minus_gt", ["application/x-troff-me"]),smalltalk.send("mesh", "__minus_gt", ["model/mesh"]),smalltalk.send("mid", "__minus_gt", ["audio/midi"]),smalltalk.send("midi", "__minus_gt", ["audio/midi"]),smalltalk.send("mif", "__minus_gt", ["application/x-mif"]),smalltalk.send("mm", "__minus_gt", ["application/x-freemind"]),smalltalk.send("mmd", "__minus_gt", ["chemical/x-macromodel-input"]),smalltalk.send("mmf", "__minus_gt", ["application/vnd.smaf"]),smalltalk.send("mml", "__minus_gt", ["text/mathml"]),smalltalk.send("mmod", "__minus_gt", ["chemical/x-macromodel-input"]),smalltalk.send("mng", "__minus_gt", ["video/x-mng"]),smalltalk.send("moc", "__minus_gt", ["text/x-moc"]),smalltalk.send("mol", "__minus_gt", ["chemical/x-mdl-molfile"]),smalltalk.send("mol2", "__minus_gt", ["chemical/x-mol2"]),smalltalk.send("moo", "__minus_gt", ["chemical/x-mopac-out"]),smalltalk.send("mop", "__minus_gt", ["chemical/x-mopac-input"]),smalltalk.send("mopcrt", "__minus_gt", ["chemical/x-mopac-input"]),smalltalk.send("mov", "__minus_gt", ["video/quicktime"]),smalltalk.send("movie", "__minus_gt", ["video/x-sgi-movie"]),smalltalk.send("mp2", "__minus_gt", ["audio/mpeg"]),smalltalk.send("mp3", "__minus_gt", ["audio/mpeg"]),smalltalk.send("mp4", "__minus_gt", ["video/mp4"]),smalltalk.send("mpc", "__minus_gt", ["chemical/x-mopac-input"]),smalltalk.send("mpe", "__minus_gt", ["video/mpeg"]),smalltalk.send("mpeg", "__minus_gt", ["video/mpeg"]),smalltalk.send("mpega", "__minus_gt", ["audio/mpeg"]),smalltalk.send("mpg", "__minus_gt", ["video/mpeg"]),smalltalk.send("mpga", "__minus_gt", ["audio/mpeg"]),smalltalk.send("ms", "__minus_gt", ["application/x-troff-ms"]),smalltalk.send("msh", "__minus_gt", ["model/mesh"]),smalltalk.send("msi", "__minus_gt", ["application/x-msi"]),smalltalk.send("mvb", "__minus_gt", ["chemical/x-mopac-vib"]),smalltalk.send("mxu", "__minus_gt", ["video/vnd.mpegurl"]),smalltalk.send("nb", "__minus_gt", ["application/mathematica"]),smalltalk.send("nc", "__minus_gt", ["application/x-netcdf"]),smalltalk.send("nwc", "__minus_gt", ["application/x-nwc"]),smalltalk.send("o", "__minus_gt", ["application/x-object"]),smalltalk.send("oda", "__minus_gt", ["application/oda"]),smalltalk.send("odb", "__minus_gt", ["application/vnd.oasis.opendocument.database"]),smalltalk.send("odc", "__minus_gt", ["application/vnd.oasis.opendocument.chart"]),smalltalk.send("odf", "__minus_gt", ["application/vnd.oasis.opendocument.formula"]),smalltalk.send("odg", "__minus_gt", ["application/vnd.oasis.opendocument.graphics"]),smalltalk.send("odi", "__minus_gt", ["application/vnd.oasis.opendocument.image"]),smalltalk.send("odm", "__minus_gt", ["application/vnd.oasis.opendocument.text-master"]),smalltalk.send("odp", "__minus_gt", ["application/vnd.oasis.opendocument.presentation"]),smalltalk.send("ods", "__minus_gt", ["application/vnd.oasis.opendocument.spreadsheet"]),smalltalk.send("odt", "__minus_gt", ["application/vnd.oasis.opendocument.text"]),smalltalk.send("ogg", "__minus_gt", ["application/ogg"]),smalltalk.send("old", "__minus_gt", ["application/x-trash"]),smalltalk.send("oth", "__minus_gt", ["application/vnd.oasis.opendocument.text-web"]),smalltalk.send("oza", "__minus_gt", ["application/x-oz-application"]),smalltalk.send("p", "__minus_gt", ["text/x-pascal"]),smalltalk.send("p7r", "__minus_gt", ["application/x-pkcs7-certreqresp"]),smalltalk.send("pac", "__minus_gt", ["application/x-ns-proxy-autoconfig"]),smalltalk.send("pas", "__minus_gt", ["text/x-pascal"]),smalltalk.send("pat", "__minus_gt", ["image/x-coreldrawpattern"]),smalltalk.send("pbm", "__minus_gt", ["image/x-portable-bitmap"]),smalltalk.send("pcf", "__minus_gt", ["application/x-font"]),smalltalk.send("pcf.Z", "__minus_gt", ["application/x-font"]),smalltalk.send("pcx", "__minus_gt", ["image/pcx"]),smalltalk.send("pdb", "__minus_gt", ["chemical/x-pdb"]),smalltalk.send("pdf", "__minus_gt", ["application/pdf"]),smalltalk.send("pfa", "__minus_gt", ["application/x-font"]),smalltalk.send("pfb", "__minus_gt", ["application/x-font"]),smalltalk.send("pgm", "__minus_gt", ["image/x-portable-graymap"]),smalltalk.send("pgn", "__minus_gt", ["application/x-chess-pgn"]),smalltalk.send("pgp", "__minus_gt", ["application/pgp-signature"]),smalltalk.send("pk", "__minus_gt", ["application/x-tex-pk"]),smalltalk.send("pl", "__minus_gt", ["text/x-perl"]),smalltalk.send("pls", "__minus_gt", ["audio/x-scpls"]),smalltalk.send("pm", "__minus_gt", ["text/x-perl"]),smalltalk.send("png", "__minus_gt", ["image/png"]),smalltalk.send("pnm", "__minus_gt", ["image/x-portable-anymap"]),smalltalk.send("pot", "__minus_gt", ["text/plain"]),smalltalk.send("ppm", "__minus_gt", ["image/x-portable-pixmap"]),smalltalk.send("pps", "__minus_gt", ["application/vnd.ms-powerpoint"]),smalltalk.send("ppt", "__minus_gt", ["application/vnd.ms-powerpoint"]),smalltalk.send("prf", "__minus_gt", ["application/pics-rules"]),smalltalk.send("prt", "__minus_gt", ["chemical/x-ncbi-asn1-ascii"]),smalltalk.send("ps", "__minus_gt", ["application/postscript"]),smalltalk.send("psd", "__minus_gt", ["image/x-photoshop"]),smalltalk.send("psp", "__minus_gt", ["text/x-psp"]),smalltalk.send("py", "__minus_gt", ["text/x-python"]),smalltalk.send("pyc", "__minus_gt", ["application/x-python-code"]),smalltalk.send("pyo", "__minus_gt", ["application/x-python-code"]),smalltalk.send("qt", "__minus_gt", ["video/quicktime"]),smalltalk.send("qtl", "__minus_gt", ["application/x-quicktimeplayer"]),smalltalk.send("ra", "__minus_gt", ["audio/x-realaudio"]),smalltalk.send("ram", "__minus_gt", ["audio/x-pn-realaudio"]),smalltalk.send("rar", "__minus_gt", ["application/rar"]),smalltalk.send("ras", "__minus_gt", ["image/x-cmu-raster"]),smalltalk.send("rd", "__minus_gt", ["chemical/x-mdl-rdfile"]),smalltalk.send("rdf", "__minus_gt", ["application/rdf+xml"]),smalltalk.send("rgb", "__minus_gt", ["image/x-rgb"]),smalltalk.send("rm", "__minus_gt", ["audio/x-pn-realaudio"]),smalltalk.send("roff", "__minus_gt", ["application/x-troff"]),smalltalk.send("ros", "__minus_gt", ["chemical/x-rosdal"]),smalltalk.send("rpm", "__minus_gt", ["application/x-redhat-package-manager"]),smalltalk.send("rss", "__minus_gt", ["application/rss+xml"]),smalltalk.send("rtf", "__minus_gt", ["text/rtf"]),smalltalk.send("rtx", "__minus_gt", ["text/richtext"]),smalltalk.send("rxn", "__minus_gt", ["chemical/x-mdl-rxnfile"]),smalltalk.send("sct", "__minus_gt", ["text/scriptlet"]),smalltalk.send("sd", "__minus_gt", ["chemical/x-mdl-sdfile"]),smalltalk.send("sd2", "__minus_gt", ["audio/x-sd2"]),smalltalk.send("sda", "__minus_gt", ["application/vnd.stardivision.draw"]),smalltalk.send("sdc", "__minus_gt", ["application/vnd.stardivision.calc"]),smalltalk.send("sdd", "__minus_gt", ["application/vnd.stardivision.impress"]),smalltalk.send("sdf", "__minus_gt", ["chemical/x-mdl-sdfile"]),smalltalk.send("sdp", "__minus_gt", ["application/vnd.stardivision.impress"]),smalltalk.send("sdw", "__minus_gt", ["application/vnd.stardivision.writer"]),smalltalk.send("ser", "__minus_gt", ["application/java-serialized-object"]),smalltalk.send("sgf", "__minus_gt", ["application/x-go-sgf"]),smalltalk.send("sgl", "__minus_gt", ["application/vnd.stardivision.writer-global"]),smalltalk.send("sh", "__minus_gt", ["text/x-sh"]),smalltalk.send("shar", "__minus_gt", ["application/x-shar"]),smalltalk.send("shtml", "__minus_gt", ["text/html"]),smalltalk.send("sid", "__minus_gt", ["audio/prs.sid"]),smalltalk.send("sik", "__minus_gt", ["application/x-trash"]),smalltalk.send("silo", "__minus_gt", ["model/mesh"]),smalltalk.send("sis", "__minus_gt", ["application/vnd.symbian.install"]),smalltalk.send("sit", "__minus_gt", ["application/x-stuffit"]),smalltalk.send("skd", "__minus_gt", ["application/x-koan"]),smalltalk.send("skm", "__minus_gt", ["application/x-koan"]),smalltalk.send("skp", "__minus_gt", ["application/x-koan"]),smalltalk.send("skt", "__minus_gt", ["application/x-koan"]),smalltalk.send("smf", "__minus_gt", ["application/vnd.stardivision.math"]),smalltalk.send("smi", "__minus_gt", ["application/smil"]),smalltalk.send("smil", "__minus_gt", ["application/smil"]),smalltalk.send("snd", "__minus_gt", ["audio/basic"]),smalltalk.send("spc", "__minus_gt", ["chemical/x-galactic-spc"]),smalltalk.send("spl", "__minus_gt", ["application/x-futuresplash"]),smalltalk.send("src", "__minus_gt", ["application/x-wais-source"]),smalltalk.send("stc", "__minus_gt", ["application/vnd.sun.xml.calc.template"]),smalltalk.send("std", "__minus_gt", ["application/vnd.sun.xml.draw.template"]),smalltalk.send("sti", "__minus_gt", ["application/vnd.sun.xml.impress.template"]),smalltalk.send("stl", "__minus_gt", ["application/vnd.ms-pki.stl"]),smalltalk.send("stw", "__minus_gt", ["application/vnd.sun.xml.writer.template"]),smalltalk.send("sty", "__minus_gt", ["text/x-tex"]),smalltalk.send("sv4cpio", "__minus_gt", ["application/x-sv4cpio"]),smalltalk.send("sv4crc", "__minus_gt", ["application/x-sv4crc"]),smalltalk.send("svg", "__minus_gt", ["image/svg+xml"]),smalltalk.send("svgz", "__minus_gt", ["image/svg+xml"]),smalltalk.send("sw", "__minus_gt", ["chemical/x-swissprot"]),smalltalk.send("swf", "__minus_gt", ["application/x-shockwave-flash"]),smalltalk.send("swfl", "__minus_gt", ["application/x-shockwave-flash"]),smalltalk.send("sxc", "__minus_gt", ["application/vnd.sun.xml.calc"]),smalltalk.send("sxd", "__minus_gt", ["application/vnd.sun.xml.draw"]),smalltalk.send("sxg", "__minus_gt", ["application/vnd.sun.xml.writer.global"]),smalltalk.send("sxi", "__minus_gt", ["application/vnd.sun.xml.impress"]),smalltalk.send("sxm", "__minus_gt", ["application/vnd.sun.xml.math"]),smalltalk.send("sxw", "__minus_gt", ["application/vnd.sun.xml.writer"]),smalltalk.send("t", "__minus_gt", ["application/x-troff"]),smalltalk.send("tar", "__minus_gt", ["application/x-tar"]),smalltalk.send("taz", "__minus_gt", ["application/x-gtar"]),smalltalk.send("tcl", "__minus_gt", ["text/x-tcl"]),smalltalk.send("tex", "__minus_gt", ["text/x-tex"]),smalltalk.send("texi", "__minus_gt", ["application/x-texinfo"]),smalltalk.send("texinfo", "__minus_gt", ["application/x-texinfo"]),smalltalk.send("text", "__minus_gt", ["text/plain"]),smalltalk.send("tgf", "__minus_gt", ["chemical/x-mdl-tgf"]),smalltalk.send("tgz", "__minus_gt", ["application/x-gtar"]),smalltalk.send("tif", "__minus_gt", ["image/tiff"]),smalltalk.send("tiff", "__minus_gt", ["image/tiff"]),smalltalk.send("tk", "__minus_gt", ["text/x-tcl"]),smalltalk.send("tm", "__minus_gt", ["text/texmacs"]),smalltalk.send("torrent", "__minus_gt", ["application/x-bittorrent"]),smalltalk.send("tr", "__minus_gt", ["application/x-troff"]),smalltalk.send("ts", "__minus_gt", ["text/texmacs"]),smalltalk.send("tsp", "__minus_gt", ["application/dsptype"]),smalltalk.send("tsv", "__minus_gt", ["text/tab-separated-values"]),smalltalk.send("txt", "__minus_gt", ["text/plain"]),smalltalk.send("udeb", "__minus_gt", ["application/x-debian-package"]),smalltalk.send("uls", "__minus_gt", ["text/iuls"]),smalltalk.send("ustar", "__minus_gt", ["application/x-ustar"]),smalltalk.send("val", "__minus_gt", ["chemical/x-ncbi-asn1-binary"]),smalltalk.send("vcd", "__minus_gt", ["application/x-cdlink"]),smalltalk.send("vcf", "__minus_gt", ["text/x-vcard"]),smalltalk.send("vcs", "__minus_gt", ["text/x-vcalendar"]),smalltalk.send("vmd", "__minus_gt", ["chemical/x-vmd"]),smalltalk.send("vms", "__minus_gt", ["chemical/x-vamas-iso14976"]),smalltalk.send("vor", "__minus_gt", ["application/vnd.stardivision.writer"]),smalltalk.send("vrm", "__minus_gt", ["x-world/x-vrml"]),smalltalk.send("vrml", "__minus_gt", ["x-world/x-vrml"]),smalltalk.send("vsd", "__minus_gt", ["application/vnd.visio"]),smalltalk.send("wad", "__minus_gt", ["application/x-doom"]),smalltalk.send("wav", "__minus_gt", ["audio/x-wav"]),smalltalk.send("wax", "__minus_gt", ["audio/x-ms-wax"]),smalltalk.send("wbmp", "__minus_gt", ["image/vnd.wap.wbmp"]),smalltalk.send("wbxml", "__minus_gt", ["application/vnd.wap.wbxml"]),smalltalk.send("wk", "__minus_gt", ["application/x-123"]),smalltalk.send("wm", "__minus_gt", ["video/x-ms-wm"]),smalltalk.send("wma", "__minus_gt", ["audio/x-ms-wma"]),smalltalk.send("wmd", "__minus_gt", ["application/x-ms-wmd"]),smalltalk.send("wml", "__minus_gt", ["text/vnd.wap.wml"]),smalltalk.send("wmlc", "__minus_gt", ["application/vnd.wap.wmlc"]),smalltalk.send("wmls", "__minus_gt", ["text/vnd.wap.wmlscript"]),smalltalk.send("wmlsc", "__minus_gt", ["application/vnd.wap.wmlscriptc"]),smalltalk.send("wmv", "__minus_gt", ["video/x-ms-wmv"]),smalltalk.send("wmx", "__minus_gt", ["video/x-ms-wmx"]),smalltalk.send("wmz", "__minus_gt", ["application/x-ms-wmz"]),smalltalk.send("wp5", "__minus_gt", ["application/wordperfect5.1"]),smalltalk.send("wpd", "__minus_gt", ["application/wordperfect"]),smalltalk.send("wrl", "__minus_gt", ["x-world/x-vrml"]),smalltalk.send("wsc", "__minus_gt", ["text/scriptlet"]),smalltalk.send("wvx", "__minus_gt", ["video/x-ms-wvx"]),smalltalk.send("wz", "__minus_gt", ["application/x-wingz"]),smalltalk.send("xbm", "__minus_gt", ["image/x-xbitmap"]),smalltalk.send("xcf", "__minus_gt", ["application/x-xcf"]),smalltalk.send("xht", "__minus_gt", ["application/xhtml+xml"]),smalltalk.send("xhtml", "__minus_gt", ["application/xhtml+xml"]),smalltalk.send("xlb", "__minus_gt", ["application/vnd.ms-excel"]),smalltalk.send("xls", "__minus_gt", ["application/vnd.ms-excel"]),smalltalk.send("xlt", "__minus_gt", ["application/vnd.ms-excel"]),smalltalk.send("xml", "__minus_gt", ["application/xml"]),smalltalk.send("xpi", "__minus_gt", ["application/x-xpinstall"]),smalltalk.send("xpm", "__minus_gt", ["image/x-xpixmap"]),smalltalk.send("xsl", "__minus_gt", ["application/xml"]),smalltalk.send("xtel", "__minus_gt", ["chemical/x-xtel"]),smalltalk.send("xul", "__minus_gt", ["application/vnd.mozilla.xul+xml"]),smalltalk.send("xwd", "__minus_gt", ["image/x-xwindowdump"]),smalltalk.send("xyz", "__minus_gt", ["chemical/x-xyz"]),smalltalk.send("zip", "__minus_gt", ["application/zip"]),smalltalk.send("zmt", "__minus_gt", ["chemical/x-mopac-input"]),smalltalk.send("~", "__minus_gt", ["application/x-trash"])]);
  10920. return self;},
  10921. args: [],
  10922. 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}",
  10923. messageSends: ["->"],
  10924. referencedClasses: []
  10925. }),
  10926. smalltalk.FileServer.klass);
  10927. smalltalk.addMethod(
  10928. "_main",
  10929. smalltalk.method({
  10930. selector: "main",
  10931. category: 'initialization',
  10932. fn: function (){
  10933. var self=this;
  10934. return smalltalk.send(smalltalk.send(self, "_new", []), "_startOn_", [smalltalk.send(self, "_port", [])]);
  10935. return self;},
  10936. args: [],
  10937. source: "main\x0a\x09^self new startOn: self port",
  10938. messageSends: ["startOn:", "new", "port"],
  10939. referencedClasses: []
  10940. }),
  10941. smalltalk.FileServer.klass);
  10942. smalltalk.addMethod(
  10943. "_mimeTypeFor_",
  10944. smalltalk.method({
  10945. selector: "mimeTypeFor:",
  10946. category: 'accessing',
  10947. fn: function (aString){
  10948. var self=this;
  10949. return smalltalk.send(smalltalk.send(self, "_mimeTypes", []), "_at_ifAbsent_", [smalltalk.send(aString, "_replace_with_", [".*[\x5c.]", ""]), (function(){return "text/plain";})]);
  10950. return self;},
  10951. args: ["aString"],
  10952. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  10953. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"],
  10954. referencedClasses: []
  10955. }),
  10956. smalltalk.FileServer.klass);
  10957. smalltalk.addMethod(
  10958. "_mimeTypes",
  10959. smalltalk.method({
  10960. selector: "mimeTypes",
  10961. category: 'accessing',
  10962. fn: function (){
  10963. var self=this;
  10964. return (($receiver = self['@mimeTypes']) == nil || $receiver == undefined) ? (function(){return (self['@mimeTypes']=smalltalk.send(self, "_defaultMimeTypes", []));})() : $receiver;
  10965. return self;},
  10966. args: [],
  10967. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  10968. messageSends: ["ifNil:", "defaultMimeTypes"],
  10969. referencedClasses: []
  10970. }),
  10971. smalltalk.FileServer.klass);
  10972. smalltalk.addMethod(
  10973. "_port",
  10974. smalltalk.method({
  10975. selector: "port",
  10976. category: 'accessing',
  10977. fn: function (){
  10978. var self=this;
  10979. return (($receiver = self['@port']) == nil || $receiver == undefined) ? (function(){return (4000);})() : $receiver;
  10980. return self;},
  10981. args: [],
  10982. source: "port\x0a\x09^port ifNil: [4000]",
  10983. messageSends: ["ifNil:"],
  10984. referencedClasses: []
  10985. }),
  10986. smalltalk.FileServer.klass);
  10987. smalltalk.addMethod(
  10988. "_port_",
  10989. smalltalk.method({
  10990. selector: "port:",
  10991. category: 'accessing',
  10992. fn: function (aNumber){
  10993. var self=this;
  10994. (self['@port']=aNumber);
  10995. return self;},
  10996. args: ["aNumber"],
  10997. source: "port: aNumber\x0a\x09port := aNumber",
  10998. messageSends: [],
  10999. referencedClasses: []
  11000. }),
  11001. smalltalk.FileServer.klass);
  11002. smalltalk.initSubTree(smalltalk.Object); //metaclasses are in through Class
  11003. smalltalk.classes()._do_(function(each) {
  11004. each._initialize()});
  11005. /* Similar to jQuery(document).ready() */
  11006. if(this.smalltalkReady) {
  11007. this.smalltalkReady();
  11008. }
  11009. smalltalk.FileServer._main()