server.js 462 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772
  1. /* ====================================================================
  2. |
  3. | Amber Smalltalk
  4. | http://amber-lang.net
  5. |
  6. ======================================================================
  7. ======================================================================
  8. |
  9. | Copyright (c) 2010-2011
  10. | Nicolas Petton <petton.nicolas@gmail.com>
  11. |
  12. | Amber is released under the MIT license
  13. |
  14. | Permission is hereby granted, free of charge, to any person obtaining
  15. | a copy of this software and associated documentation files (the
  16. | 'Software'), to deal in the Software without restriction, including
  17. | without limitation the rights to use, copy, modify, merge, publish,
  18. | distribute, sublicense, and/or sell copies of the Software, and to
  19. | permit persons to whom the Software is furnished to do so, subject to
  20. | the following conditions:
  21. |
  22. | The above copyright notice and this permission notice shall be
  23. | included in all copies or substantial portions of the Software.
  24. |
  25. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  26. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  28. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  29. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  30. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  31. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. |
  33. ==================================================================== */
  34. /* Make sure that console is defined */
  35. if (typeof console === "undefined") {
  36. this.console = {
  37. log: function() {},
  38. warn: function() {},
  39. info: function() {},
  40. debug: function() {},
  41. error: function() {}
  42. };
  43. }
  44. /* 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 SmalltalkOrganizer() {
  58. this.elements = [];
  59. };
  60. SmalltalkOrganizer.prototype.addElement = function(el) {
  61. if(typeof el === 'undefined' || el === nil) {
  62. return false;
  63. }
  64. if(this.elements.indexOf(el) == -1) {
  65. this.elements.push(el);
  66. }
  67. };
  68. SmalltalkOrganizer.prototype.removeElement = function(el) {
  69. for(var i=0; i<this.elements.length; i++) {
  70. if(this.elements[i] == el) {
  71. this.elements.splice(i, 1);
  72. break;
  73. }
  74. }
  75. };
  76. function Smalltalk(){
  77. var st = this;
  78. /* This is the current call context object. While it is publicly available,
  79. Use smalltalk.getThisContext() instead which will answer a safe copy of
  80. the current context */
  81. st.thisContext = undefined;
  82. /* List of all reserved words in JavaScript. They may not be used as variables
  83. in Smalltalk. */
  84. // list of reserved JavaScript keywords as of
  85. // http://es5.github.com/#x7.6.1.1
  86. // and
  87. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  88. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  89. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  90. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  91. 'try', 'typeof', 'var', 'void', 'while', 'with',
  92. // ES5: future use: http://es5.github.com/#x7.6.1.2
  93. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  94. // ES5: future use in strict mode
  95. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  96. 'public', 'static', 'yield'];
  97. /* The symbol table ensures symbol unicity */
  98. symbolTable = {};
  99. st.symbolFor = function(string) {
  100. if(symbolTable[string] === undefined) {
  101. symbolTable[string] = new SmalltalkSymbol(string);
  102. };
  103. return symbolTable[string];
  104. };
  105. /* Unique ID number generator */
  106. oid = 0;
  107. st.nextId = function() {
  108. oid += 1;
  109. return oid;
  110. };
  111. /* We hold all Packages in a separate Object */
  112. st.packages = {};
  113. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  114. function pkg(spec) {
  115. var that = new SmalltalkPackage();
  116. that.pkgName = spec.pkgName;
  117. that.organization = new SmalltalkOrganizer();
  118. that.properties = spec.properties || {};
  119. return that;
  120. };
  121. /* Smalltalk class creation. A class is an instance of an automatically
  122. created metaclass object. Newly created classes (not their metaclass)
  123. should be added to the smalltalk object, see smalltalk.addClass().
  124. Superclass linking is *not* handled here, see smalltalk.init() */
  125. function klass(spec) {
  126. var spec = spec || {};
  127. var meta = metaclass();
  128. var that = setupClass(meta.instanceClass, spec);
  129. that.className = spec.className;
  130. meta.className = spec.className + ' class';
  131. if(spec.superclass) {
  132. that.superclass = spec.superclass;
  133. meta.superclass = spec.superclass.klass;
  134. }
  135. return that;
  136. }
  137. function metaclass() {
  138. var meta = setupClass(new SmalltalkMetaclass(), {})
  139. meta.instanceClass = new meta.fn;
  140. return meta;
  141. }
  142. function setupClass(that, spec) {
  143. that.fn = spec.fn || function(){};
  144. that.iVarNames = spec.iVarNames || [];
  145. Object.defineProperty(that, "toString", {
  146. value: function() { return 'Smalltalk ' + this.className; },
  147. configurable: true // no writable - in par with ES6 methods
  148. });
  149. that.organization = new SmalltalkOrganizer();
  150. that.pkg = spec.pkg;
  151. Object.defineProperties(that.fn.prototype, {
  152. methods: { value: {}, enumerable: false, configurable: true, writable: true },
  153. inheritedMethods: { value: {}, enumerable: false, configurable: true, writable: true },
  154. klass: { value: that, enumerable: false, configurable: true, writable: true }
  155. });
  156. return that;
  157. };
  158. /* Smalltalk method object. To add a method to a class,
  159. use smalltalk.addMethod() */
  160. st.method = function(spec) {
  161. var that = new SmalltalkMethod();
  162. that.selector = spec.selector;
  163. that.jsSelector = spec.jsSelector;
  164. that.args = spec.args || {};
  165. that.category = spec.category;
  166. that.source = spec.source;
  167. that.messageSends = spec.messageSends || [];
  168. that.referencedClasses = spec.referencedClasses || [];
  169. that.fn = spec.fn;
  170. return that;
  171. };
  172. /* Initialize a class in its class hierarchy. Handle both class and
  173. metaclasses. */
  174. st.init = function(klass) {
  175. st.initClass(klass);
  176. if(klass.klass && !klass.meta) {
  177. st.initClass(klass.klass);
  178. }
  179. };
  180. st.initClass = function(klass) {
  181. var subclasses = st.subclasses(klass);
  182. var methods, prototype = klass.fn.prototype;
  183. if(klass.superclass && klass.superclass !== nil) {
  184. methods = st.methods(klass.superclass);
  185. //Methods linking
  186. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  187. var key = keys[i];
  188. if(!prototype.methods[key]) {
  189. prototype.inheritedMethods[key] = methods[key];
  190. Object.defineProperty(prototype, methods[key].jsSelector, {
  191. value: methods[key].fn, configurable: true, writable: true
  192. });
  193. }
  194. }
  195. }
  196. for(var i=0; i<subclasses.length; i++) {
  197. st.initClass(subclasses[i]);
  198. }
  199. };
  200. /* Answer all registered Packages as Array */
  201. st.packages.all = function() {
  202. var packages = [];
  203. for(var i in st.packages) {
  204. if (!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  205. packages.push(st.packages[i]);
  206. }
  207. return packages
  208. };
  209. /* Answer all registered Smalltalk classes */
  210. st.classes = function() {
  211. var classes = [], names = Object.keys(st), l = names.length;
  212. for (var i=0; i<l; i++) {
  213. var name = names[i];
  214. if (name.search(/^[A-Z]/) !== -1) {
  215. classes.push(st[name]);
  216. }
  217. }
  218. return classes;
  219. };
  220. /* Answer all methods (included inherited ones) of klass. */
  221. st.methods = function(klass) {
  222. var methods = {};
  223. inheritedMethods = klass.fn.prototype.inheritedMethods;
  224. for(var i=0, keys=Object.keys(inheritedMethods); i<keys.length; i++) {
  225. methods[keys[i]] = inheritedMethods[keys[i]];
  226. }
  227. var inheritedMethods = klass.fn.prototype.methods;
  228. for(var i=0, keys=Object.keys(inheritedMethods); i<keys.length; i++) {
  229. methods[keys[i]] = inheritedMethods[keys[i]];
  230. }
  231. return methods;
  232. };
  233. /* Answer the direct subclasses of klass. */
  234. st.subclasses = function(klass) {
  235. var subclasses = [];
  236. var classes = st.classes();
  237. for(var i=0; i < classes.length; i++) {
  238. var c = classes[i];
  239. if(c.fn) {
  240. //Classes
  241. if(c.superclass === klass) {
  242. subclasses.push(c);
  243. }
  244. c = c.klass;
  245. //Metaclasses
  246. if(c && c.superclass === klass) {
  247. subclasses.push(c);
  248. }
  249. }
  250. }
  251. return subclasses;
  252. };
  253. /* Create a new class wrapping a JavaScript constructor, and add it to the
  254. global smalltalk object. Package is lazily created if it does not exist with given name. */
  255. st.wrapClassName = function(className, pkgName, fn, superclass) {
  256. var pkg = st.addPackage(pkgName);
  257. st[className] = klass({
  258. className: className,
  259. superclass: superclass,
  260. pkg: pkg,
  261. fn: fn
  262. });
  263. };
  264. /* Create an alias for an existing class */
  265. st.alias = function(klass, alias) {
  266. st[alias] = klass;
  267. }
  268. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  269. If pkgName is null or empty we return nil, which is an allowed package for a class.
  270. If package already exists we still update the properties of it. */
  271. st.addPackage = function(pkgName, properties) {
  272. if(!pkgName) {return nil;}
  273. if(!(st.packages[pkgName])) {
  274. st.packages[pkgName] = pkg({
  275. pkgName: pkgName,
  276. properties: properties
  277. });
  278. } else {
  279. if(properties) {
  280. st.packages[pkgName].properties = properties;
  281. }
  282. }
  283. return st.packages[pkgName];
  284. };
  285. /* Add a class to the smalltalk object, creating a new one if needed.
  286. A Package is lazily created if it does not exist with given name. */
  287. st.addClass = function(className, superclass, iVarNames, pkgName) {
  288. var pkg = st.addPackage(pkgName);
  289. if(st[className]) {
  290. st[className].superclass = superclass;
  291. st[className].iVarNames = iVarNames;
  292. st[className].pkg = pkg || st[className].pkg;
  293. } else {
  294. st[className] = klass({
  295. className: className,
  296. superclass: superclass,
  297. pkg: pkg,
  298. iVarNames: iVarNames
  299. });
  300. }
  301. pkg.organization.addElement(st[className]);
  302. };
  303. st.removeClass = function(klass) {
  304. klass.pkg.organization.removeElement(klass);
  305. delete st[klass.className];
  306. };
  307. /* Add/remove a method to/from a class */
  308. st.addMethod = function(jsSelector, method, klass) {
  309. Object.defineProperty(klass.fn.prototype, jsSelector, {
  310. value: method.fn, configurable: true, writable: true
  311. });
  312. klass.fn.prototype.methods[method.selector] = method;
  313. method.methodClass = klass;
  314. method.jsSelector = jsSelector;
  315. klass.organization.addElement(method.category);
  316. };
  317. st.removeMethod = function(method) {
  318. var protocol = method.category;
  319. var klass = method.methodClass;
  320. var methods = klass.fn.prototype.methods;
  321. delete klass.fn.prototype[method.selector._asSelector()];
  322. delete methods[method.selector];
  323. var selectors = Object.keys(methods);
  324. var shouldDeleteProtocol = true;
  325. for(var i= 0, l = selectors.length; i<l; i++) {
  326. if(methods[selectors[i]].category === protocol) {
  327. shouldDeleteProtocol = false;
  328. break;
  329. };
  330. };
  331. if(shouldDeleteProtocol) {
  332. klass.organization.removeElement(protocol)
  333. };
  334. };
  335. /* Handles unhandled errors during message sends */
  336. st.send = function(receiver, selector, args, klass) {
  337. if(st.thisContext) {
  338. return withContextSend(receiver, selector, args, klass);
  339. } else {
  340. try {return withContextSend(receiver, selector, args, klass)}
  341. catch(error) {
  342. // Reset the context stack in any case
  343. st.thisContext = undefined;
  344. if(error.smalltalkError) {
  345. handleError(error);
  346. } else {
  347. throw(error);
  348. }
  349. }
  350. }
  351. };
  352. function withContextSend(receiver, selector, args, klass) {
  353. var call, method;
  354. if(receiver == null) {
  355. receiver = nil;
  356. }
  357. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  358. if(method) {
  359. var context = pushContext(receiver, selector, method, args);
  360. call = method.apply(receiver, args);
  361. popContext(context);
  362. return call;
  363. } else {
  364. return messageNotUnderstood(receiver, selector, args);
  365. }
  366. };
  367. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  368. (See the Smalltalk class ErrorHandler and its subclasses */
  369. function handleError(error) {
  370. if(!error.cc) {
  371. smalltalk.ErrorHandler._current()._handleError_(error);
  372. }
  373. };
  374. /* Handles #dnu: *and* JavaScript method calls.
  375. if the receiver has no klass, we consider it a JS object (outside of the
  376. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  377. function messageNotUnderstood(receiver, selector, args) {
  378. /* Handles JS method calls. */
  379. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  380. return callJavaScriptMethod(receiver, selector, args);
  381. }
  382. /* Handles not understood messages. Also see the Amber counter-part
  383. Object>>doesNotUnderstand: */
  384. return receiver._doesNotUnderstand_(
  385. st.Message._new()
  386. ._selector_(st.convertSelector(selector))
  387. ._arguments_(args)
  388. );
  389. };
  390. /* Call a method of a JS object, or answer a property if it exists.
  391. Else try wrapping a JSObjectProxy around the receiver.
  392. If the object property is a function, then call it, except if it starts with
  393. an uppercase character (we probably want to answer the function itself in this
  394. case and send it #new from Amber).
  395. Converts keyword-based selectors by using the first
  396. keyword only, but keeping all message arguments.
  397. Example:
  398. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  399. function callJavaScriptMethod(receiver, selector, args) {
  400. var jsSelector = selector._asJavaScriptSelector();
  401. var jsProperty = receiver[jsSelector];
  402. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  403. return jsProperty.apply(receiver, args);
  404. } else if(jsProperty !== undefined) {
  405. if(args[0]) {
  406. receiver[jsSelector] = args[0];
  407. return nil;
  408. } else {
  409. return jsProperty;
  410. }
  411. }
  412. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  413. };
  414. /* Reuse one old context stored in oldContext */
  415. st.oldContext = null;
  416. /* Handle thisContext pseudo variable */
  417. st.getThisContext = function() {
  418. if(st.thisContext) {
  419. return st.thisContext.copy();
  420. }
  421. };
  422. function pushContext(receiver, selector, method, temps) {
  423. var c = st.oldContext, tc = st.thisContext;
  424. if (!c) {
  425. return st.thisContext = new SmalltalkMethodContext(receiver, selector, method, temps, tc);
  426. }
  427. st.oldContext = null;
  428. c.homeContext = tc;
  429. c.pc = 1;
  430. c.receiver = receiver;
  431. c.selector = selector;
  432. c.method = method;
  433. c.temps = temps || {};
  434. return st.thisContext = c;
  435. };
  436. function popContext(context) {
  437. st.thisContext = context.homeContext;
  438. context.homeContext = undefined;
  439. st.oldContext = context;
  440. };
  441. /* Convert a string to a valid smalltalk selector.
  442. if you modify the following functions, also change String>>asSelector
  443. accordingly */
  444. st.convertSelector = function(selector) {
  445. if(selector.match(/__/)) {
  446. return convertBinarySelector(selector);
  447. } else {
  448. return convertKeywordSelector(selector);
  449. }
  450. };
  451. function convertKeywordSelector(selector) {
  452. return selector.replace(/^_/, '').replace(/_/g, ':');
  453. };
  454. function convertBinarySelector(selector) {
  455. return selector
  456. .replace(/^_/, '')
  457. .replace(/_plus/, '+')
  458. .replace(/_minus/, '-')
  459. .replace(/_star/, '*')
  460. .replace(/_slash/, '/')
  461. .replace(/_gt/, '>')
  462. .replace(/_lt/, '<')
  463. .replace(/_eq/, '=')
  464. .replace(/_comma/, ',')
  465. .replace(/_at/, '@')
  466. };
  467. /* Converts a JavaScript object to valid Smalltalk Object */
  468. st.readJSObject = function(js) {
  469. var object = js;
  470. var readObject = (js.constructor === Object);
  471. var readArray = (js.constructor === Array);
  472. if(readObject) {
  473. object = smalltalk.Dictionary._new();
  474. }
  475. for(var i in js) {
  476. if(readObject) {
  477. object._at_put_(i, st.readJSObject(js[i]));
  478. }
  479. if(readArray) {
  480. object[i] = st.readJSObject(js[i]);
  481. }
  482. }
  483. return object;
  484. };
  485. /* Boolean assertion */
  486. st.assert = function(shouldBeBoolean) {
  487. if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
  488. return shouldBeBoolean;
  489. } else {
  490. smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  491. }
  492. }
  493. };
  494. function SmalltalkMethodContext(receiver, selector, method, temps, home) {
  495. this.receiver = receiver;
  496. this.selector = selector;
  497. this.method = method;
  498. this.temps = temps || {};
  499. this.homeContext = home;
  500. };
  501. SmalltalkMethodContext.prototype.copy = function() {
  502. var home = this.homeContext;
  503. if(home) {home = home.copy()}
  504. return new SmalltalkMethodContext(
  505. this.receiver,
  506. this.selector,
  507. this.method,
  508. this.temps,
  509. home
  510. );
  511. };
  512. SmalltalkMethodContext.prototype.resume = function() {
  513. //Brutally set the receiver as thisContext, then re-enter the function
  514. smalltalk.thisContext = this;
  515. return this.method.apply(receiver, temps);
  516. };
  517. /* Global Smalltalk objects. */
  518. var nil = new SmalltalkNil();
  519. var smalltalk = new Smalltalk();
  520. if(this.jQuery) {
  521. this.jQuery.allowJavaScriptCalls = true;
  522. }
  523. /****************************************************************************************/
  524. /* Base classes wrapping. If you edit this part, do not forget to set the superclass of the
  525. object metaclass to Class after the definition of Object */
  526. smalltalk.wrapClassName("Object", "Kernel", SmalltalkObject);
  527. smalltalk.wrapClassName("Smalltalk", "Kernel", Smalltalk, smalltalk.Object);
  528. smalltalk.wrapClassName("Package", "Kernel", SmalltalkPackage, smalltalk.Object);
  529. smalltalk.wrapClassName("Behavior", "Kernel", SmalltalkBehavior, smalltalk.Object);
  530. smalltalk.wrapClassName("Class", "Kernel", SmalltalkClass, smalltalk.Behavior);
  531. smalltalk.wrapClassName("Metaclass", "Kernel", SmalltalkMetaclass, smalltalk.Behavior);
  532. smalltalk.wrapClassName("CompiledMethod", "Kernel", SmalltalkMethod, smalltalk.Object);
  533. smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object);
  534. smalltalk.Object.klass.superclass = smalltalk.Class;
  535. smalltalk.wrapClassName("Number", "Kernel", Number, smalltalk.Object);
  536. smalltalk.wrapClassName("BlockClosure", "Kernel", Function, smalltalk.Object);
  537. smalltalk.wrapClassName("Boolean", "Kernel", Boolean, smalltalk.Object);
  538. smalltalk.wrapClassName("Date", "Kernel", Date, smalltalk.Object);
  539. smalltalk.wrapClassName("UndefinedObject", "Kernel", SmalltalkNil, smalltalk.Object);
  540. smalltalk.wrapClassName("Collection", "Kernel", null, smalltalk.Object);
  541. smalltalk.wrapClassName("SequenceableCollection", "Kernel", null, smalltalk.Collection);
  542. smalltalk.wrapClassName("CharacterArray", "Kernel", null, smalltalk.SequenceableCollection);
  543. smalltalk.wrapClassName("String", "Kernel", String, smalltalk.CharacterArray);
  544. smalltalk.wrapClassName("Symbol", "Kernel", SmalltalkSymbol, smalltalk.CharacterArray);
  545. smalltalk.wrapClassName("Array", "Kernel", Array, smalltalk.SequenceableCollection);
  546. smalltalk.wrapClassName("RegularExpression", "Kernel", RegExp, smalltalk.String);
  547. smalltalk.wrapClassName("Error", "Kernel", Error, smalltalk.Object);
  548. smalltalk.wrapClassName("MethodContext", "Kernel", SmalltalkMethodContext, smalltalk.Object);
  549. /* Alias definitions */
  550. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  551. smalltalk.alias(smalltalk.Date, "Time");
  552. smalltalk.addPackage('Kernel-Objects', {});
  553. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  554. 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."
  555. smalltalk.addMethod(
  556. "__minus_gt",
  557. smalltalk.method({
  558. selector: "->",
  559. category: 'converting',
  560. fn: function (anObject) {
  561. var self = this;
  562. var $1;
  563. $1 = smalltalk.send(smalltalk.Association || Association, "_key_value_", [self, anObject]);
  564. return $1;
  565. },
  566. args: ["anObject"],
  567. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  568. messageSends: ["key:value:"],
  569. referencedClasses: ["Association"]
  570. }),
  571. smalltalk.Object);
  572. smalltalk.addMethod(
  573. "__eq",
  574. smalltalk.method({
  575. selector: "=",
  576. category: 'comparing',
  577. fn: function (anObject) {
  578. var self = this;
  579. var $1;
  580. $1 = smalltalk.send(self, "__eq_eq", [anObject]);
  581. return $1;
  582. },
  583. args: ["anObject"],
  584. source: "= anObject\x0a\x09^self == anObject",
  585. messageSends: ["=="],
  586. referencedClasses: []
  587. }),
  588. smalltalk.Object);
  589. smalltalk.addMethod(
  590. "__eq_eq",
  591. smalltalk.method({
  592. selector: "==",
  593. category: 'comparing',
  594. fn: function (anObject) {
  595. var self = this;
  596. var $1;
  597. $1 = smalltalk.send(smalltalk.send(self, "_identityHash", []), "__eq", [smalltalk.send(anObject, "_identityHash", [])]);
  598. return $1;
  599. },
  600. args: ["anObject"],
  601. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  602. messageSends: ["=", "identityHash"],
  603. referencedClasses: []
  604. }),
  605. smalltalk.Object);
  606. smalltalk.addMethod(
  607. "_asJSON",
  608. smalltalk.method({
  609. selector: "asJSON",
  610. category: 'converting',
  611. fn: function () {
  612. var self = this;
  613. var variables;
  614. variables = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  615. 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", [])]);}]);
  616. return variables;
  617. },
  618. args: [],
  619. 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",
  620. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  621. referencedClasses: ["HashedCollection"]
  622. }),
  623. smalltalk.Object);
  624. smalltalk.addMethod(
  625. "_asJSONString",
  626. smalltalk.method({
  627. selector: "asJSONString",
  628. category: 'converting',
  629. fn: function () {
  630. var self = this;
  631. var $1;
  632. $1 = smalltalk.send(smalltalk.JSON || JSON, "_stringify_", [smalltalk.send(self, "_asJSON", [])]);
  633. return $1;
  634. },
  635. args: [],
  636. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  637. messageSends: ["stringify:", "asJSON"],
  638. referencedClasses: ["JSON"]
  639. }),
  640. smalltalk.Object);
  641. smalltalk.addMethod(
  642. "_asJavascript",
  643. smalltalk.method({
  644. selector: "asJavascript",
  645. category: 'converting',
  646. fn: function () {
  647. var self = this;
  648. var $1;
  649. $1 = smalltalk.send(self, "_asString", []);
  650. return $1;
  651. },
  652. args: [],
  653. source: "asJavascript\x0a\x09^self asString",
  654. messageSends: ["asString"],
  655. referencedClasses: []
  656. }),
  657. smalltalk.Object);
  658. smalltalk.addMethod(
  659. "_asString",
  660. smalltalk.method({
  661. selector: "asString",
  662. category: 'converting',
  663. fn: function () {
  664. var self = this;
  665. var $1;
  666. $1 = smalltalk.send(self, "_printString", []);
  667. return $1;
  668. },
  669. args: [],
  670. source: "asString\x0a\x09^self printString",
  671. messageSends: ["printString"],
  672. referencedClasses: []
  673. }),
  674. smalltalk.Object);
  675. smalltalk.addMethod(
  676. "_basicAt_",
  677. smalltalk.method({
  678. selector: "basicAt:",
  679. category: 'accessing',
  680. fn: function (aString) {
  681. var self = this;
  682. return self[aString];
  683. return self;
  684. },
  685. args: ["aString"],
  686. source: "basicAt: aString\x0a\x09<return self[aString]>",
  687. messageSends: [],
  688. referencedClasses: []
  689. }),
  690. smalltalk.Object);
  691. smalltalk.addMethod(
  692. "_basicAt_put_",
  693. smalltalk.method({
  694. selector: "basicAt:put:",
  695. category: 'accessing',
  696. fn: function (aString, anObject) {
  697. var self = this;
  698. return self[aString] = anObject;
  699. return self;
  700. },
  701. args: ["aString", "anObject"],
  702. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  703. messageSends: [],
  704. referencedClasses: []
  705. }),
  706. smalltalk.Object);
  707. smalltalk.addMethod(
  708. "_basicDelete_",
  709. smalltalk.method({
  710. selector: "basicDelete:",
  711. category: 'accessing',
  712. fn: function (aString) {
  713. var self = this;
  714. delete self[aString];
  715. return aString;
  716. return self;
  717. },
  718. args: ["aString"],
  719. source: "basicDelete: aString\x0a <delete self[aString]; return aString>",
  720. messageSends: [],
  721. referencedClasses: []
  722. }),
  723. smalltalk.Object);
  724. smalltalk.addMethod(
  725. "_basicPerform_",
  726. smalltalk.method({
  727. selector: "basicPerform:",
  728. category: 'message handling',
  729. fn: function (aSymbol) {
  730. var self = this;
  731. var $1;
  732. $1 = smalltalk.send(self, "_basicPerform_withArguments_", [aSymbol, []]);
  733. return $1;
  734. },
  735. args: ["aSymbol"],
  736. source: "basicPerform: aSymbol \x0a\x09^self basicPerform: aSymbol withArguments: #()",
  737. messageSends: ["basicPerform:withArguments:"],
  738. referencedClasses: []
  739. }),
  740. smalltalk.Object);
  741. smalltalk.addMethod(
  742. "_basicPerform_withArguments_",
  743. smalltalk.method({
  744. selector: "basicPerform:withArguments:",
  745. category: 'message handling',
  746. fn: function (aSymbol, aCollection) {
  747. var self = this;
  748. return self[aSymbol].apply(self, aCollection);
  749. return self;
  750. },
  751. args: ["aSymbol", "aCollection"],
  752. source: "basicPerform: aSymbol withArguments: aCollection\x0a\x09<return self[aSymbol].apply(self, aCollection);>",
  753. messageSends: [],
  754. referencedClasses: []
  755. }),
  756. smalltalk.Object);
  757. smalltalk.addMethod(
  758. "_class",
  759. smalltalk.method({
  760. selector: "class",
  761. category: 'accessing',
  762. fn: function () {
  763. var self = this;
  764. return self.klass;
  765. return self;
  766. },
  767. args: [],
  768. source: "class\x0a\x09<return self.klass>",
  769. messageSends: [],
  770. referencedClasses: []
  771. }),
  772. smalltalk.Object);
  773. smalltalk.addMethod(
  774. "_copy",
  775. smalltalk.method({
  776. selector: "copy",
  777. category: 'copying',
  778. fn: function () {
  779. var self = this;
  780. var $1;
  781. $1 = smalltalk.send(smalltalk.send(self, "_shallowCopy", []), "_postCopy", []);
  782. return $1;
  783. },
  784. args: [],
  785. source: "copy\x0a\x09^self shallowCopy postCopy",
  786. messageSends: ["postCopy", "shallowCopy"],
  787. referencedClasses: []
  788. }),
  789. smalltalk.Object);
  790. smalltalk.addMethod(
  791. "_deepCopy",
  792. smalltalk.method({
  793. selector: "deepCopy",
  794. category: 'copying',
  795. fn: function () {
  796. var self = this;
  797. var copy = self.klass._new();
  798. for (var i in self) {
  799. if (/^@.+/.test(i)) {
  800. copy[i] = self[i]._deepCopy();
  801. }
  802. }
  803. return copy;
  804. return self;
  805. },
  806. args: [],
  807. 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>",
  808. messageSends: [],
  809. referencedClasses: []
  810. }),
  811. smalltalk.Object);
  812. smalltalk.addMethod(
  813. "_deprecatedAPI",
  814. smalltalk.method({
  815. selector: "deprecatedAPI",
  816. category: 'error handling',
  817. fn: function () {
  818. var self = this;
  819. smalltalk.send(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", [")"])]);
  820. return self;
  821. },
  822. args: [],
  823. 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, ')'",
  824. messageSends: ["warn:", ",", "asString", "home"],
  825. referencedClasses: []
  826. }),
  827. smalltalk.Object);
  828. smalltalk.addMethod(
  829. "_doesNotUnderstand_",
  830. smalltalk.method({
  831. selector: "doesNotUnderstand:",
  832. category: 'error handling',
  833. fn: function (aMessage) {
  834. var self = this;
  835. var $1, $2;
  836. $1 = smalltalk.send(smalltalk.MessageNotUnderstood || MessageNotUnderstood, "_new", []);
  837. smalltalk.send($1, "_receiver_", [self]);
  838. smalltalk.send($1, "_message_", [aMessage]);
  839. $2 = smalltalk.send($1, "_signal", []);
  840. return self;
  841. },
  842. args: ["aMessage"],
  843. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  844. messageSends: ["receiver:", "new", "message:", "signal"],
  845. referencedClasses: ["MessageNotUnderstood"]
  846. }),
  847. smalltalk.Object);
  848. smalltalk.addMethod(
  849. "_error_",
  850. smalltalk.method({
  851. selector: "error:",
  852. category: 'error handling',
  853. fn: function (aString) {
  854. var self = this;
  855. smalltalk.send(smalltalk.Error || Error, "_signal_", [aString]);
  856. return self;
  857. },
  858. args: ["aString"],
  859. source: "error: aString\x0a\x09Error signal: aString",
  860. messageSends: ["signal:"],
  861. referencedClasses: ["Error"]
  862. }),
  863. smalltalk.Object);
  864. smalltalk.addMethod(
  865. "_halt",
  866. smalltalk.method({
  867. selector: "halt",
  868. category: 'error handling',
  869. fn: function () {
  870. var self = this;
  871. smalltalk.send(self, "_error_", ["Halt encountered"]);
  872. return self;
  873. },
  874. args: [],
  875. source: "halt\x0a\x09self error: 'Halt encountered'",
  876. messageSends: ["error:"],
  877. referencedClasses: []
  878. }),
  879. smalltalk.Object);
  880. smalltalk.addMethod(
  881. "_identityHash",
  882. smalltalk.method({
  883. selector: "identityHash",
  884. category: 'accessing',
  885. fn: function () {
  886. var self = this;
  887. var hash = self.identityHash;
  888. if (hash) {
  889. return hash;
  890. }
  891. hash = smalltalk.nextId();
  892. Object.defineProperty(self, "identityHash", {value: hash});
  893. return hash;
  894. return self;
  895. },
  896. args: [],
  897. 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>",
  898. messageSends: [],
  899. referencedClasses: []
  900. }),
  901. smalltalk.Object);
  902. smalltalk.addMethod(
  903. "_ifNil_",
  904. smalltalk.method({
  905. selector: "ifNil:",
  906. category: 'testing',
  907. fn: function (aBlock) {
  908. var self = this;
  909. return self;
  910. },
  911. args: ["aBlock"],
  912. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.Object);
  917. smalltalk.addMethod(
  918. "_ifNil_ifNotNil_",
  919. smalltalk.method({
  920. selector: "ifNil:ifNotNil:",
  921. category: 'testing',
  922. fn: function (aBlock, anotherBlock) {
  923. var self = this;
  924. var $1;
  925. $1 = smalltalk.send(anotherBlock, "_value", []);
  926. return $1;
  927. },
  928. args: ["aBlock", "anotherBlock"],
  929. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  930. messageSends: ["value"],
  931. referencedClasses: []
  932. }),
  933. smalltalk.Object);
  934. smalltalk.addMethod(
  935. "_ifNotNil_",
  936. smalltalk.method({
  937. selector: "ifNotNil:",
  938. category: 'testing',
  939. fn: function (aBlock) {
  940. var self = this;
  941. var $1;
  942. $1 = smalltalk.send(aBlock, "_value", []);
  943. return $1;
  944. },
  945. args: ["aBlock"],
  946. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  947. messageSends: ["value"],
  948. referencedClasses: []
  949. }),
  950. smalltalk.Object);
  951. smalltalk.addMethod(
  952. "_ifNotNil_ifNil_",
  953. smalltalk.method({
  954. selector: "ifNotNil:ifNil:",
  955. category: 'testing',
  956. fn: function (aBlock, anotherBlock) {
  957. var self = this;
  958. var $1;
  959. $1 = smalltalk.send(aBlock, "_value", []);
  960. return $1;
  961. },
  962. args: ["aBlock", "anotherBlock"],
  963. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  964. messageSends: ["value"],
  965. referencedClasses: []
  966. }),
  967. smalltalk.Object);
  968. smalltalk.addMethod(
  969. "_initialize",
  970. smalltalk.method({
  971. selector: "initialize",
  972. category: 'initialization',
  973. fn: function () {
  974. var self = this;
  975. return self;
  976. },
  977. args: [],
  978. source: "initialize",
  979. messageSends: [],
  980. referencedClasses: []
  981. }),
  982. smalltalk.Object);
  983. smalltalk.addMethod(
  984. "_instVarAt_",
  985. smalltalk.method({
  986. selector: "instVarAt:",
  987. category: 'accessing',
  988. fn: function (aSymbol) {
  989. var self = this;
  990. var varname;
  991. varname = smalltalk.send(aSymbol, "_asString", []);
  992. return self["@" + varname];
  993. return self;
  994. },
  995. args: ["aSymbol"],
  996. source: "instVarAt: aSymbol\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<return self['@'+varname]>",
  997. messageSends: ["asString"],
  998. referencedClasses: []
  999. }),
  1000. smalltalk.Object);
  1001. smalltalk.addMethod(
  1002. "_instVarAt_put_",
  1003. smalltalk.method({
  1004. selector: "instVarAt:put:",
  1005. category: 'accessing',
  1006. fn: function (aSymbol, anObject) {
  1007. var self = this;
  1008. var varname;
  1009. varname = smalltalk.send(aSymbol, "_asString", []);
  1010. self["@" + varname] = anObject;
  1011. return self;
  1012. },
  1013. args: ["aSymbol", "anObject"],
  1014. source: "instVarAt: aSymbol put: anObject\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<self['@' + varname] = anObject>",
  1015. messageSends: ["asString"],
  1016. referencedClasses: []
  1017. }),
  1018. smalltalk.Object);
  1019. smalltalk.addMethod(
  1020. "_isClass",
  1021. smalltalk.method({
  1022. selector: "isClass",
  1023. category: 'testing',
  1024. fn: function () {
  1025. var self = this;
  1026. return false;
  1027. },
  1028. args: [],
  1029. source: "isClass\x0a\x09^false",
  1030. messageSends: [],
  1031. referencedClasses: []
  1032. }),
  1033. smalltalk.Object);
  1034. smalltalk.addMethod(
  1035. "_isKindOf_",
  1036. smalltalk.method({
  1037. selector: "isKindOf:",
  1038. category: 'testing',
  1039. fn: function (aClass) {
  1040. var self = this;
  1041. var $2, $1;
  1042. $2 = smalltalk.send(self, "_isMemberOf_", [aClass]);
  1043. if (smalltalk.assert($2)) {
  1044. $1 = true;
  1045. } else {
  1046. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);
  1047. }
  1048. return $1;
  1049. },
  1050. args: ["aClass"],
  1051. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: [self class inheritsFrom: aClass]",
  1052. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  1053. referencedClasses: []
  1054. }),
  1055. smalltalk.Object);
  1056. smalltalk.addMethod(
  1057. "_isMemberOf_",
  1058. smalltalk.method({
  1059. selector: "isMemberOf:",
  1060. category: 'testing',
  1061. fn: function (aClass) {
  1062. var self = this;
  1063. var $1;
  1064. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [aClass]);
  1065. return $1;
  1066. },
  1067. args: ["aClass"],
  1068. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1069. messageSends: ["=", "class"],
  1070. referencedClasses: []
  1071. }),
  1072. smalltalk.Object);
  1073. smalltalk.addMethod(
  1074. "_isMetaclass",
  1075. smalltalk.method({
  1076. selector: "isMetaclass",
  1077. category: 'testing',
  1078. fn: function () {
  1079. var self = this;
  1080. return false;
  1081. },
  1082. args: [],
  1083. source: "isMetaclass\x0a\x09^false",
  1084. messageSends: [],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.Object);
  1088. smalltalk.addMethod(
  1089. "_isNil",
  1090. smalltalk.method({
  1091. selector: "isNil",
  1092. category: 'testing',
  1093. fn: function () {
  1094. var self = this;
  1095. return false;
  1096. },
  1097. args: [],
  1098. source: "isNil\x0a\x09^false",
  1099. messageSends: [],
  1100. referencedClasses: []
  1101. }),
  1102. smalltalk.Object);
  1103. smalltalk.addMethod(
  1104. "_isNumber",
  1105. smalltalk.method({
  1106. selector: "isNumber",
  1107. category: 'testing',
  1108. fn: function () {
  1109. var self = this;
  1110. return false;
  1111. },
  1112. args: [],
  1113. source: "isNumber\x0a\x09^false",
  1114. messageSends: [],
  1115. referencedClasses: []
  1116. }),
  1117. smalltalk.Object);
  1118. smalltalk.addMethod(
  1119. "_isParseFailure",
  1120. smalltalk.method({
  1121. selector: "isParseFailure",
  1122. category: 'testing',
  1123. fn: function () {
  1124. var self = this;
  1125. return false;
  1126. },
  1127. args: [],
  1128. source: "isParseFailure\x0a\x09^false",
  1129. messageSends: [],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.Object);
  1133. smalltalk.addMethod(
  1134. "_isString",
  1135. smalltalk.method({
  1136. selector: "isString",
  1137. category: 'testing',
  1138. fn: function () {
  1139. var self = this;
  1140. return false;
  1141. },
  1142. args: [],
  1143. source: "isString\x0a\x09^false",
  1144. messageSends: [],
  1145. referencedClasses: []
  1146. }),
  1147. smalltalk.Object);
  1148. smalltalk.addMethod(
  1149. "_isSymbol",
  1150. smalltalk.method({
  1151. selector: "isSymbol",
  1152. category: 'testing',
  1153. fn: function () {
  1154. var self = this;
  1155. return false;
  1156. },
  1157. args: [],
  1158. source: "isSymbol\x0a\x09^false",
  1159. messageSends: [],
  1160. referencedClasses: []
  1161. }),
  1162. smalltalk.Object);
  1163. smalltalk.addMethod(
  1164. "_log_block_",
  1165. smalltalk.method({
  1166. selector: "log:block:",
  1167. category: 'printing',
  1168. fn: function (aString, aBlock) {
  1169. var self = this;
  1170. var result;
  1171. smalltalk.send(console, "_log_", [smalltalk.send(smalltalk.send(aString, "__comma", [" time: "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [function () {result = smalltalk.send(aBlock, "_value", []);return result;}]), "_printString", [])])]);
  1172. return result;
  1173. },
  1174. args: ["aString", "aBlock"],
  1175. source: "log: aString block: aBlock\x0a\x0a\x09| result |\x0a\x09console log: aString, ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.\x0a\x09^result",
  1176. messageSends: ["log:", ",", "printString", "millisecondsToRun:", "value"],
  1177. referencedClasses: ["Date"]
  1178. }),
  1179. smalltalk.Object);
  1180. smalltalk.addMethod(
  1181. "_notNil",
  1182. smalltalk.method({
  1183. selector: "notNil",
  1184. category: 'testing',
  1185. fn: function () {
  1186. var self = this;
  1187. var $1;
  1188. $1 = smalltalk.send(smalltalk.send(self, "_isNil", []), "_not", []);
  1189. return $1;
  1190. },
  1191. args: [],
  1192. source: "notNil\x0a\x09^self isNil not",
  1193. messageSends: ["not", "isNil"],
  1194. referencedClasses: []
  1195. }),
  1196. smalltalk.Object);
  1197. smalltalk.addMethod(
  1198. "_perform_",
  1199. smalltalk.method({
  1200. selector: "perform:",
  1201. category: 'message handling',
  1202. fn: function (aSymbol) {
  1203. var self = this;
  1204. var $1;
  1205. $1 = smalltalk.send(self, "_perform_withArguments_", [aSymbol, []]);
  1206. return $1;
  1207. },
  1208. args: ["aSymbol"],
  1209. source: "perform: aSymbol\x0a\x09^self perform: aSymbol withArguments: #()",
  1210. messageSends: ["perform:withArguments:"],
  1211. referencedClasses: []
  1212. }),
  1213. smalltalk.Object);
  1214. smalltalk.addMethod(
  1215. "_perform_withArguments_",
  1216. smalltalk.method({
  1217. selector: "perform:withArguments:",
  1218. category: 'message handling',
  1219. fn: function (aSymbol, aCollection) {
  1220. var self = this;
  1221. var selector;
  1222. selector = smalltalk.send(aSymbol, "_asSelector", []);
  1223. return smalltalk.send(self, selector, aCollection);
  1224. return self;
  1225. },
  1226. args: ["aSymbol", "aCollection"],
  1227. source: "perform: aSymbol withArguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSymbol asSelector.\x0a\x09<return smalltalk.send(self, selector, aCollection)>",
  1228. messageSends: ["asSelector"],
  1229. referencedClasses: []
  1230. }),
  1231. smalltalk.Object);
  1232. smalltalk.addMethod(
  1233. "_postCopy",
  1234. smalltalk.method({
  1235. selector: "postCopy",
  1236. category: 'copying',
  1237. fn: function () {
  1238. var self = this;
  1239. return self;
  1240. },
  1241. args: [],
  1242. source: "postCopy",
  1243. messageSends: [],
  1244. referencedClasses: []
  1245. }),
  1246. smalltalk.Object);
  1247. smalltalk.addMethod(
  1248. "_printNl",
  1249. smalltalk.method({
  1250. selector: "printNl",
  1251. category: 'printing',
  1252. fn: function () {
  1253. var self = this;
  1254. console.log(self);
  1255. return self;
  1256. },
  1257. args: [],
  1258. source: "printNl\x0a\x09<console.log(self)>",
  1259. messageSends: [],
  1260. referencedClasses: []
  1261. }),
  1262. smalltalk.Object);
  1263. smalltalk.addMethod(
  1264. "_printString",
  1265. smalltalk.method({
  1266. selector: "printString",
  1267. category: 'printing',
  1268. fn: function () {
  1269. var self = this;
  1270. var $1;
  1271. $1 = smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]);
  1272. return $1;
  1273. },
  1274. args: [],
  1275. source: "printString\x0a\x09^'a ', self class name",
  1276. messageSends: [",", "name", "class"],
  1277. referencedClasses: []
  1278. }),
  1279. smalltalk.Object);
  1280. smalltalk.addMethod(
  1281. "_respondsTo_",
  1282. smalltalk.method({
  1283. selector: "respondsTo:",
  1284. category: 'testing',
  1285. fn: function (aSelector) {
  1286. var self = this;
  1287. var $1;
  1288. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_canUnderstand_", [aSelector]);
  1289. return $1;
  1290. },
  1291. args: ["aSelector"],
  1292. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1293. messageSends: ["canUnderstand:", "class"],
  1294. referencedClasses: []
  1295. }),
  1296. smalltalk.Object);
  1297. smalltalk.addMethod(
  1298. "_shallowCopy",
  1299. smalltalk.method({
  1300. selector: "shallowCopy",
  1301. category: 'copying',
  1302. fn: function () {
  1303. var self = this;
  1304. var copy = self.klass._new();
  1305. for (var i in self) {
  1306. if (/^@.+/.test(i)) {
  1307. copy[i] = self[i];
  1308. }
  1309. }
  1310. return copy;
  1311. return self;
  1312. },
  1313. args: [],
  1314. 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>",
  1315. messageSends: [],
  1316. referencedClasses: []
  1317. }),
  1318. smalltalk.Object);
  1319. smalltalk.addMethod(
  1320. "_shouldNotImplement",
  1321. smalltalk.method({
  1322. selector: "shouldNotImplement",
  1323. category: 'error handling',
  1324. fn: function () {
  1325. var self = this;
  1326. smalltalk.send(self, "_error_", [smalltalk.send("This method should not be implemented in ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])])]);
  1327. return self;
  1328. },
  1329. args: [],
  1330. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1331. messageSends: ["error:", ",", "name", "class"],
  1332. referencedClasses: []
  1333. }),
  1334. smalltalk.Object);
  1335. smalltalk.addMethod(
  1336. "_size",
  1337. smalltalk.method({
  1338. selector: "size",
  1339. category: 'accessing',
  1340. fn: function () {
  1341. var self = this;
  1342. smalltalk.send(self, "_error_", ["Object not indexable"]);
  1343. return self;
  1344. },
  1345. args: [],
  1346. source: "size\x0a\x09self error: 'Object not indexable'",
  1347. messageSends: ["error:"],
  1348. referencedClasses: []
  1349. }),
  1350. smalltalk.Object);
  1351. smalltalk.addMethod(
  1352. "_storeOn_",
  1353. smalltalk.method({
  1354. selector: "storeOn:",
  1355. category: 'printing',
  1356. fn: function (aStream) {
  1357. var self = this;
  1358. smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [])]);
  1359. return self;
  1360. },
  1361. args: ["aStream"],
  1362. source: "storeOn: aStream\x0a\x09aStream nextPutAll: self printString",
  1363. messageSends: ["nextPutAll:", "printString"],
  1364. referencedClasses: []
  1365. }),
  1366. smalltalk.Object);
  1367. smalltalk.addMethod(
  1368. "_storeString",
  1369. smalltalk.method({
  1370. selector: "storeString",
  1371. category: 'printing',
  1372. fn: function () {
  1373. var self = this;
  1374. var $1;
  1375. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (s) {return smalltalk.send(self, "_storeOn_", [s]);}]);
  1376. return $1;
  1377. },
  1378. args: [],
  1379. 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]",
  1380. messageSends: ["streamContents:", "storeOn:"],
  1381. referencedClasses: ["String"]
  1382. }),
  1383. smalltalk.Object);
  1384. smalltalk.addMethod(
  1385. "_subclassResponsibility",
  1386. smalltalk.method({
  1387. selector: "subclassResponsibility",
  1388. category: 'error handling',
  1389. fn: function () {
  1390. var self = this;
  1391. smalltalk.send(self, "_error_", ["This method is a responsibility of a subclass"]);
  1392. return self;
  1393. },
  1394. args: [],
  1395. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1396. messageSends: ["error:"],
  1397. referencedClasses: []
  1398. }),
  1399. smalltalk.Object);
  1400. smalltalk.addMethod(
  1401. "_throw_",
  1402. smalltalk.method({
  1403. selector: "throw:",
  1404. category: 'error handling',
  1405. fn: function (anObject) {
  1406. var self = this;
  1407. throw anObject;
  1408. return self;
  1409. },
  1410. args: ["anObject"],
  1411. source: "throw: anObject\x0a\x09< throw anObject >",
  1412. messageSends: [],
  1413. referencedClasses: []
  1414. }),
  1415. smalltalk.Object);
  1416. smalltalk.addMethod(
  1417. "_try_catch_",
  1418. smalltalk.method({
  1419. selector: "try:catch:",
  1420. category: 'error handling',
  1421. fn: function (aBlock, anotherBlock) {
  1422. var self = this;
  1423. try {
  1424. result = aBlock();
  1425. } catch (e) {
  1426. result = anotherBlock(e);
  1427. }
  1428. return result;
  1429. return self;
  1430. },
  1431. args: ["aBlock", "anotherBlock"],
  1432. source: "try: aBlock catch: anotherBlock\x0a\x09<try{result = aBlock()} catch(e) {result = anotherBlock(e)};\x0a\x09return result;>",
  1433. messageSends: [],
  1434. referencedClasses: []
  1435. }),
  1436. smalltalk.Object);
  1437. smalltalk.addMethod(
  1438. "_value",
  1439. smalltalk.method({
  1440. selector: "value",
  1441. category: 'accessing',
  1442. fn: function () {
  1443. var self = this;
  1444. return self;
  1445. },
  1446. args: [],
  1447. source: "value\x0a\x09^ self",
  1448. messageSends: [],
  1449. referencedClasses: []
  1450. }),
  1451. smalltalk.Object);
  1452. smalltalk.addMethod(
  1453. "_yourself",
  1454. smalltalk.method({
  1455. selector: "yourself",
  1456. category: 'accessing',
  1457. fn: function () {
  1458. var self = this;
  1459. return self;
  1460. },
  1461. args: [],
  1462. source: "yourself\x0a\x09^self",
  1463. messageSends: [],
  1464. referencedClasses: []
  1465. }),
  1466. smalltalk.Object);
  1467. smalltalk.addMethod(
  1468. "_~_eq",
  1469. smalltalk.method({
  1470. selector: "~=",
  1471. category: 'comparing',
  1472. fn: function (anObject) {
  1473. var self = this;
  1474. var $1;
  1475. $1 = smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq", [false]);
  1476. return $1;
  1477. },
  1478. args: ["anObject"],
  1479. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1480. messageSends: ["="],
  1481. referencedClasses: []
  1482. }),
  1483. smalltalk.Object);
  1484. smalltalk.addMethod(
  1485. "_~~",
  1486. smalltalk.method({
  1487. selector: "~~",
  1488. category: 'comparing',
  1489. fn: function (anObject) {
  1490. var self = this;
  1491. var $1;
  1492. $1 = smalltalk.send(smalltalk.send(self, "__eq_eq", [anObject]), "__eq", [false]);
  1493. return $1;
  1494. },
  1495. args: ["anObject"],
  1496. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1497. messageSends: ["=", "=="],
  1498. referencedClasses: []
  1499. }),
  1500. smalltalk.Object);
  1501. smalltalk.addMethod(
  1502. "_initialize",
  1503. smalltalk.method({
  1504. selector: "initialize",
  1505. category: 'initialization',
  1506. fn: function () {
  1507. var self = this;
  1508. return self;
  1509. },
  1510. args: [],
  1511. source: "initialize\x0a\x09\x22no op\x22",
  1512. messageSends: [],
  1513. referencedClasses: []
  1514. }),
  1515. smalltalk.Object.klass);
  1516. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1517. 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`."
  1518. smalltalk.addMethod(
  1519. "_&",
  1520. smalltalk.method({
  1521. selector: "&",
  1522. category: 'controlling',
  1523. fn: function (aBoolean) {
  1524. var self = this;
  1525. if (self == true) {
  1526. return aBoolean;
  1527. } else {
  1528. return false;
  1529. }
  1530. return self;
  1531. },
  1532. args: ["aBoolean"],
  1533. source: "& aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09 } else {\x0a\x09\x09return false;\x0a\x09 }\x0a\x09>",
  1534. messageSends: [],
  1535. referencedClasses: []
  1536. }),
  1537. smalltalk.Boolean);
  1538. smalltalk.addMethod(
  1539. "__eq",
  1540. smalltalk.method({
  1541. selector: "=",
  1542. category: 'comparing',
  1543. fn: function (aBoolean) {
  1544. var self = this;
  1545. var $1;
  1546. $1 = smalltalk.send(smalltalk.send(aBoolean, "_class", []), "__eq", [smalltalk.send(self, "_class", [])]);
  1547. if (!smalltalk.assert($1)) {
  1548. return false;
  1549. }
  1550. return Boolean(self == true) == aBoolean;
  1551. return self;
  1552. },
  1553. args: ["aBoolean"],
  1554. source: "= aBoolean\x0a\x09aBoolean class = self class ifFalse: [^false].\x0a\x09<return Boolean(self == true) == aBoolean>",
  1555. messageSends: ["ifFalse:", "=", "class"],
  1556. referencedClasses: []
  1557. }),
  1558. smalltalk.Boolean);
  1559. smalltalk.addMethod(
  1560. "__eq_eq",
  1561. smalltalk.method({
  1562. selector: "==",
  1563. category: 'comparing',
  1564. fn: function (aBoolean) {
  1565. var self = this;
  1566. var $1;
  1567. $1 = smalltalk.send(self, "__eq", [aBoolean]);
  1568. return $1;
  1569. },
  1570. args: ["aBoolean"],
  1571. source: "== aBoolean\x0a\x09^self = aBoolean",
  1572. messageSends: ["="],
  1573. referencedClasses: []
  1574. }),
  1575. smalltalk.Boolean);
  1576. smalltalk.addMethod(
  1577. "_and_",
  1578. smalltalk.method({
  1579. selector: "and:",
  1580. category: 'controlling',
  1581. fn: function (aBlock) {
  1582. var self = this;
  1583. var $2, $1;
  1584. $2 = smalltalk.send(self, "__eq", [true]);
  1585. $1 = smalltalk.send($2, "_ifTrue_ifFalse_", [aBlock, function () {return false;}]);
  1586. return $1;
  1587. },
  1588. args: ["aBlock"],
  1589. source: "and: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: aBlock\x0a\x09 ifFalse: [false]",
  1590. messageSends: ["ifTrue:ifFalse:", "="],
  1591. referencedClasses: []
  1592. }),
  1593. smalltalk.Boolean);
  1594. smalltalk.addMethod(
  1595. "_asJSON",
  1596. smalltalk.method({
  1597. selector: "asJSON",
  1598. category: 'converting',
  1599. fn: function () {
  1600. var self = this;
  1601. return self;
  1602. },
  1603. args: [],
  1604. source: "asJSON\x0a\x09^self",
  1605. messageSends: [],
  1606. referencedClasses: []
  1607. }),
  1608. smalltalk.Boolean);
  1609. smalltalk.addMethod(
  1610. "_deepCopy",
  1611. smalltalk.method({
  1612. selector: "deepCopy",
  1613. category: 'copying',
  1614. fn: function () {
  1615. var self = this;
  1616. return self;
  1617. },
  1618. args: [],
  1619. source: "deepCopy\x0a\x09^self",
  1620. messageSends: [],
  1621. referencedClasses: []
  1622. }),
  1623. smalltalk.Boolean);
  1624. smalltalk.addMethod(
  1625. "_ifFalse_",
  1626. smalltalk.method({
  1627. selector: "ifFalse:",
  1628. category: 'controlling',
  1629. fn: function (aBlock) {
  1630. var self = this;
  1631. var $1;
  1632. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [function () {}, aBlock]);
  1633. return $1;
  1634. },
  1635. args: ["aBlock"],
  1636. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1637. messageSends: ["ifTrue:ifFalse:"],
  1638. referencedClasses: []
  1639. }),
  1640. smalltalk.Boolean);
  1641. smalltalk.addMethod(
  1642. "_ifFalse_ifTrue_",
  1643. smalltalk.method({
  1644. selector: "ifFalse:ifTrue:",
  1645. category: 'controlling',
  1646. fn: function (aBlock, anotherBlock) {
  1647. var self = this;
  1648. var $1;
  1649. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  1650. return $1;
  1651. },
  1652. args: ["aBlock", "anotherBlock"],
  1653. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1654. messageSends: ["ifTrue:ifFalse:"],
  1655. referencedClasses: []
  1656. }),
  1657. smalltalk.Boolean);
  1658. smalltalk.addMethod(
  1659. "_ifTrue_",
  1660. smalltalk.method({
  1661. selector: "ifTrue:",
  1662. category: 'controlling',
  1663. fn: function (aBlock) {
  1664. var self = this;
  1665. var $1;
  1666. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, function () {}]);
  1667. return $1;
  1668. },
  1669. args: ["aBlock"],
  1670. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1671. messageSends: ["ifTrue:ifFalse:"],
  1672. referencedClasses: []
  1673. }),
  1674. smalltalk.Boolean);
  1675. smalltalk.addMethod(
  1676. "_ifTrue_ifFalse_",
  1677. smalltalk.method({
  1678. selector: "ifTrue:ifFalse:",
  1679. category: 'controlling',
  1680. fn: function (aBlock, anotherBlock) {
  1681. var self = this;
  1682. if (self == true) {
  1683. return aBlock();
  1684. } else {
  1685. return anotherBlock();
  1686. }
  1687. return self;
  1688. },
  1689. args: ["aBlock", "anotherBlock"],
  1690. 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>",
  1691. messageSends: [],
  1692. referencedClasses: []
  1693. }),
  1694. smalltalk.Boolean);
  1695. smalltalk.addMethod(
  1696. "_not",
  1697. smalltalk.method({
  1698. selector: "not",
  1699. category: 'controlling',
  1700. fn: function () {
  1701. var self = this;
  1702. var $1;
  1703. $1 = smalltalk.send(self, "__eq", [false]);
  1704. return $1;
  1705. },
  1706. args: [],
  1707. source: "not\x0a\x09^self = false",
  1708. messageSends: ["="],
  1709. referencedClasses: []
  1710. }),
  1711. smalltalk.Boolean);
  1712. smalltalk.addMethod(
  1713. "_or_",
  1714. smalltalk.method({
  1715. selector: "or:",
  1716. category: 'controlling',
  1717. fn: function (aBlock) {
  1718. var self = this;
  1719. var $2, $1;
  1720. $2 = smalltalk.send(self, "__eq", [true]);
  1721. $1 = smalltalk.send($2, "_ifTrue_ifFalse_", [function () {return true;}, aBlock]);
  1722. return $1;
  1723. },
  1724. args: ["aBlock"],
  1725. source: "or: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: aBlock",
  1726. messageSends: ["ifTrue:ifFalse:", "="],
  1727. referencedClasses: []
  1728. }),
  1729. smalltalk.Boolean);
  1730. smalltalk.addMethod(
  1731. "_printString",
  1732. smalltalk.method({
  1733. selector: "printString",
  1734. category: 'printing',
  1735. fn: function () {
  1736. var self = this;
  1737. return self.toString();
  1738. return self;
  1739. },
  1740. args: [],
  1741. source: "printString\x0a\x09<return self.toString()>",
  1742. messageSends: [],
  1743. referencedClasses: []
  1744. }),
  1745. smalltalk.Boolean);
  1746. smalltalk.addMethod(
  1747. "_shallowCopy",
  1748. smalltalk.method({
  1749. selector: "shallowCopy",
  1750. category: 'copying',
  1751. fn: function () {
  1752. var self = this;
  1753. return self;
  1754. },
  1755. args: [],
  1756. source: "shallowCopy\x0a\x09^self",
  1757. messageSends: [],
  1758. referencedClasses: []
  1759. }),
  1760. smalltalk.Boolean);
  1761. smalltalk.addMethod(
  1762. "_|",
  1763. smalltalk.method({
  1764. selector: "|",
  1765. category: 'controlling',
  1766. fn: function (aBoolean) {
  1767. var self = this;
  1768. if (self == true) {
  1769. return true;
  1770. } else {
  1771. return aBoolean;
  1772. }
  1773. return self;
  1774. },
  1775. args: ["aBoolean"],
  1776. source: "| aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return true;\x0a\x09 } else {\x0a\x09\x09return aBoolean;\x0a\x09 }\x0a\x09>",
  1777. messageSends: [],
  1778. referencedClasses: []
  1779. }),
  1780. smalltalk.Boolean);
  1781. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1782. 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."
  1783. smalltalk.addMethod(
  1784. "__plus",
  1785. smalltalk.method({
  1786. selector: "+",
  1787. category: 'arithmetic',
  1788. fn: function (aDate) {
  1789. var self = this;
  1790. return self + aDate;
  1791. return self;
  1792. },
  1793. args: ["aDate"],
  1794. source: "+ aDate\x0a\x09<return self + aDate>",
  1795. messageSends: [],
  1796. referencedClasses: []
  1797. }),
  1798. smalltalk.Date);
  1799. smalltalk.addMethod(
  1800. "__minus",
  1801. smalltalk.method({
  1802. selector: "-",
  1803. category: 'arithmetic',
  1804. fn: function (aDate) {
  1805. var self = this;
  1806. return self - aDate;
  1807. return self;
  1808. },
  1809. args: ["aDate"],
  1810. source: "- aDate\x0a\x09<return self - aDate>",
  1811. messageSends: [],
  1812. referencedClasses: []
  1813. }),
  1814. smalltalk.Date);
  1815. smalltalk.addMethod(
  1816. "__lt",
  1817. smalltalk.method({
  1818. selector: "<",
  1819. category: 'comparing',
  1820. fn: function (aDate) {
  1821. var self = this;
  1822. return self < aDate;
  1823. return self;
  1824. },
  1825. args: ["aDate"],
  1826. source: "< aDate\x0a\x09<return self < aDate>",
  1827. messageSends: [],
  1828. referencedClasses: []
  1829. }),
  1830. smalltalk.Date);
  1831. smalltalk.addMethod(
  1832. "__lt_eq",
  1833. smalltalk.method({
  1834. selector: "<=",
  1835. category: 'comparing',
  1836. fn: function (aDate) {
  1837. var self = this;
  1838. return self <= aDate;
  1839. return self;
  1840. },
  1841. args: ["aDate"],
  1842. source: "<= aDate\x0a\x09<return self <= aDate>",
  1843. messageSends: [],
  1844. referencedClasses: []
  1845. }),
  1846. smalltalk.Date);
  1847. smalltalk.addMethod(
  1848. "__gt",
  1849. smalltalk.method({
  1850. selector: ">",
  1851. category: 'comparing',
  1852. fn: function (aDate) {
  1853. var self = this;
  1854. return self > aDate;
  1855. return self;
  1856. },
  1857. args: ["aDate"],
  1858. source: "> aDate\x0a\x09<return self >> aDate>",
  1859. messageSends: [],
  1860. referencedClasses: []
  1861. }),
  1862. smalltalk.Date);
  1863. smalltalk.addMethod(
  1864. "__gt_eq",
  1865. smalltalk.method({
  1866. selector: ">=",
  1867. category: 'comparing',
  1868. fn: function (aDate) {
  1869. var self = this;
  1870. return self >= aDate;
  1871. return self;
  1872. },
  1873. args: ["aDate"],
  1874. source: ">= aDate\x0a\x09<return self >>= aDate>",
  1875. messageSends: [],
  1876. referencedClasses: []
  1877. }),
  1878. smalltalk.Date);
  1879. smalltalk.addMethod(
  1880. "_asDateString",
  1881. smalltalk.method({
  1882. selector: "asDateString",
  1883. category: 'converting',
  1884. fn: function () {
  1885. var self = this;
  1886. return self.toDateString();
  1887. return self;
  1888. },
  1889. args: [],
  1890. source: "asDateString\x0a\x09<return self.toDateString()>",
  1891. messageSends: [],
  1892. referencedClasses: []
  1893. }),
  1894. smalltalk.Date);
  1895. smalltalk.addMethod(
  1896. "_asLocaleString",
  1897. smalltalk.method({
  1898. selector: "asLocaleString",
  1899. category: 'converting',
  1900. fn: function () {
  1901. var self = this;
  1902. return self.toLocaleString();
  1903. return self;
  1904. },
  1905. args: [],
  1906. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  1907. messageSends: [],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.Date);
  1911. smalltalk.addMethod(
  1912. "_asMilliseconds",
  1913. smalltalk.method({
  1914. selector: "asMilliseconds",
  1915. category: 'converting',
  1916. fn: function () {
  1917. var self = this;
  1918. var $1;
  1919. $1 = smalltalk.send(self, "_time", []);
  1920. return $1;
  1921. },
  1922. args: [],
  1923. source: "asMilliseconds\x0a\x09^self time",
  1924. messageSends: ["time"],
  1925. referencedClasses: []
  1926. }),
  1927. smalltalk.Date);
  1928. smalltalk.addMethod(
  1929. "_asNumber",
  1930. smalltalk.method({
  1931. selector: "asNumber",
  1932. category: 'converting',
  1933. fn: function () {
  1934. var self = this;
  1935. var $1;
  1936. $1 = smalltalk.send(self, "_asMilliseconds", []);
  1937. return $1;
  1938. },
  1939. args: [],
  1940. source: "asNumber\x0a\x09^self asMilliseconds",
  1941. messageSends: ["asMilliseconds"],
  1942. referencedClasses: []
  1943. }),
  1944. smalltalk.Date);
  1945. smalltalk.addMethod(
  1946. "_asString",
  1947. smalltalk.method({
  1948. selector: "asString",
  1949. category: 'converting',
  1950. fn: function () {
  1951. var self = this;
  1952. return self.toString();
  1953. return self;
  1954. },
  1955. args: [],
  1956. source: "asString\x0a\x09<return self.toString()>",
  1957. messageSends: [],
  1958. referencedClasses: []
  1959. }),
  1960. smalltalk.Date);
  1961. smalltalk.addMethod(
  1962. "_asTimeString",
  1963. smalltalk.method({
  1964. selector: "asTimeString",
  1965. category: 'converting',
  1966. fn: function () {
  1967. var self = this;
  1968. return self.toTimeString();
  1969. return self;
  1970. },
  1971. args: [],
  1972. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  1973. messageSends: [],
  1974. referencedClasses: []
  1975. }),
  1976. smalltalk.Date);
  1977. smalltalk.addMethod(
  1978. "_day",
  1979. smalltalk.method({
  1980. selector: "day",
  1981. category: 'accessing',
  1982. fn: function () {
  1983. var self = this;
  1984. var $1;
  1985. $1 = smalltalk.send(self, "_dayOfWeek", []);
  1986. return $1;
  1987. },
  1988. args: [],
  1989. source: "day\x0a\x09^self dayOfWeek",
  1990. messageSends: ["dayOfWeek"],
  1991. referencedClasses: []
  1992. }),
  1993. smalltalk.Date);
  1994. smalltalk.addMethod(
  1995. "_day_",
  1996. smalltalk.method({
  1997. selector: "day:",
  1998. category: 'accessing',
  1999. fn: function (aNumber) {
  2000. var self = this;
  2001. smalltalk.send(self, "_dayOfWeek_", [aNumber]);
  2002. return self;
  2003. },
  2004. args: ["aNumber"],
  2005. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2006. messageSends: ["dayOfWeek:"],
  2007. referencedClasses: []
  2008. }),
  2009. smalltalk.Date);
  2010. smalltalk.addMethod(
  2011. "_dayOfMonth",
  2012. smalltalk.method({
  2013. selector: "dayOfMonth",
  2014. category: 'accessing',
  2015. fn: function () {
  2016. var self = this;
  2017. return self.getDate();
  2018. return self;
  2019. },
  2020. args: [],
  2021. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2022. messageSends: [],
  2023. referencedClasses: []
  2024. }),
  2025. smalltalk.Date);
  2026. smalltalk.addMethod(
  2027. "_dayOfMonth_",
  2028. smalltalk.method({
  2029. selector: "dayOfMonth:",
  2030. category: 'accessing',
  2031. fn: function (aNumber) {
  2032. var self = this;
  2033. self.setDate(aNumber);
  2034. return self;
  2035. },
  2036. args: ["aNumber"],
  2037. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2038. messageSends: [],
  2039. referencedClasses: []
  2040. }),
  2041. smalltalk.Date);
  2042. smalltalk.addMethod(
  2043. "_dayOfWeek",
  2044. smalltalk.method({
  2045. selector: "dayOfWeek",
  2046. category: 'accessing',
  2047. fn: function () {
  2048. var self = this;
  2049. return self.getDay() + 1;
  2050. return self;
  2051. },
  2052. args: [],
  2053. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2054. messageSends: [],
  2055. referencedClasses: []
  2056. }),
  2057. smalltalk.Date);
  2058. smalltalk.addMethod(
  2059. "_dayOfWeek_",
  2060. smalltalk.method({
  2061. selector: "dayOfWeek:",
  2062. category: 'accessing',
  2063. fn: function (aNumber) {
  2064. var self = this;
  2065. return self.setDay(aNumber - 1);
  2066. return self;
  2067. },
  2068. args: ["aNumber"],
  2069. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2070. messageSends: [],
  2071. referencedClasses: []
  2072. }),
  2073. smalltalk.Date);
  2074. smalltalk.addMethod(
  2075. "_hours",
  2076. smalltalk.method({
  2077. selector: "hours",
  2078. category: 'accessing',
  2079. fn: function () {
  2080. var self = this;
  2081. return self.getHours();
  2082. return self;
  2083. },
  2084. args: [],
  2085. source: "hours\x0a\x09<return self.getHours()>",
  2086. messageSends: [],
  2087. referencedClasses: []
  2088. }),
  2089. smalltalk.Date);
  2090. smalltalk.addMethod(
  2091. "_hours_",
  2092. smalltalk.method({
  2093. selector: "hours:",
  2094. category: 'accessing',
  2095. fn: function (aNumber) {
  2096. var self = this;
  2097. self.setHours(aNumber);
  2098. return self;
  2099. },
  2100. args: ["aNumber"],
  2101. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2102. messageSends: [],
  2103. referencedClasses: []
  2104. }),
  2105. smalltalk.Date);
  2106. smalltalk.addMethod(
  2107. "_milliseconds",
  2108. smalltalk.method({
  2109. selector: "milliseconds",
  2110. category: 'accessing',
  2111. fn: function () {
  2112. var self = this;
  2113. return self.getMilliseconds();
  2114. return self;
  2115. },
  2116. args: [],
  2117. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2118. messageSends: [],
  2119. referencedClasses: []
  2120. }),
  2121. smalltalk.Date);
  2122. smalltalk.addMethod(
  2123. "_milliseconds_",
  2124. smalltalk.method({
  2125. selector: "milliseconds:",
  2126. category: 'accessing',
  2127. fn: function (aNumber) {
  2128. var self = this;
  2129. self.setMilliseconds(aNumber);
  2130. return self;
  2131. },
  2132. args: ["aNumber"],
  2133. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2134. messageSends: [],
  2135. referencedClasses: []
  2136. }),
  2137. smalltalk.Date);
  2138. smalltalk.addMethod(
  2139. "_minutes",
  2140. smalltalk.method({
  2141. selector: "minutes",
  2142. category: 'accessing',
  2143. fn: function () {
  2144. var self = this;
  2145. return self.getMinutes();
  2146. return self;
  2147. },
  2148. args: [],
  2149. source: "minutes\x0a\x09<return self.getMinutes()>",
  2150. messageSends: [],
  2151. referencedClasses: []
  2152. }),
  2153. smalltalk.Date);
  2154. smalltalk.addMethod(
  2155. "_minutes_",
  2156. smalltalk.method({
  2157. selector: "minutes:",
  2158. category: 'accessing',
  2159. fn: function (aNumber) {
  2160. var self = this;
  2161. self.setMinutes(aNumber);
  2162. return self;
  2163. },
  2164. args: ["aNumber"],
  2165. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2166. messageSends: [],
  2167. referencedClasses: []
  2168. }),
  2169. smalltalk.Date);
  2170. smalltalk.addMethod(
  2171. "_month",
  2172. smalltalk.method({
  2173. selector: "month",
  2174. category: 'accessing',
  2175. fn: function () {
  2176. var self = this;
  2177. return self.getMonth() + 1;
  2178. return self;
  2179. },
  2180. args: [],
  2181. source: "month\x0a\x09<return self.getMonth() + 1>",
  2182. messageSends: [],
  2183. referencedClasses: []
  2184. }),
  2185. smalltalk.Date);
  2186. smalltalk.addMethod(
  2187. "_month_",
  2188. smalltalk.method({
  2189. selector: "month:",
  2190. category: 'accessing',
  2191. fn: function (aNumber) {
  2192. var self = this;
  2193. self.setMonth(aNumber - 1);
  2194. return self;
  2195. },
  2196. args: ["aNumber"],
  2197. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2198. messageSends: [],
  2199. referencedClasses: []
  2200. }),
  2201. smalltalk.Date);
  2202. smalltalk.addMethod(
  2203. "_printString",
  2204. smalltalk.method({
  2205. selector: "printString",
  2206. category: 'printing',
  2207. fn: function () {
  2208. var self = this;
  2209. var $1;
  2210. $1 = smalltalk.send(self, "_asString", []);
  2211. return $1;
  2212. },
  2213. args: [],
  2214. source: "printString\x0a\x09^self asString",
  2215. messageSends: ["asString"],
  2216. referencedClasses: []
  2217. }),
  2218. smalltalk.Date);
  2219. smalltalk.addMethod(
  2220. "_seconds",
  2221. smalltalk.method({
  2222. selector: "seconds",
  2223. category: 'accessing',
  2224. fn: function () {
  2225. var self = this;
  2226. return self.getSeconds();
  2227. return self;
  2228. },
  2229. args: [],
  2230. source: "seconds\x0a\x09<return self.getSeconds()>",
  2231. messageSends: [],
  2232. referencedClasses: []
  2233. }),
  2234. smalltalk.Date);
  2235. smalltalk.addMethod(
  2236. "_seconds_",
  2237. smalltalk.method({
  2238. selector: "seconds:",
  2239. category: 'accessing',
  2240. fn: function (aNumber) {
  2241. var self = this;
  2242. self.setSeconds(aNumber);
  2243. return self;
  2244. },
  2245. args: ["aNumber"],
  2246. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2247. messageSends: [],
  2248. referencedClasses: []
  2249. }),
  2250. smalltalk.Date);
  2251. smalltalk.addMethod(
  2252. "_time",
  2253. smalltalk.method({
  2254. selector: "time",
  2255. category: 'accessing',
  2256. fn: function () {
  2257. var self = this;
  2258. return self.getTime();
  2259. return self;
  2260. },
  2261. args: [],
  2262. source: "time\x0a\x09<return self.getTime()>",
  2263. messageSends: [],
  2264. referencedClasses: []
  2265. }),
  2266. smalltalk.Date);
  2267. smalltalk.addMethod(
  2268. "_time_",
  2269. smalltalk.method({
  2270. selector: "time:",
  2271. category: 'accessing',
  2272. fn: function (aNumber) {
  2273. var self = this;
  2274. self.setTime(aNumber);
  2275. return self;
  2276. },
  2277. args: ["aNumber"],
  2278. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2279. messageSends: [],
  2280. referencedClasses: []
  2281. }),
  2282. smalltalk.Date);
  2283. smalltalk.addMethod(
  2284. "_year",
  2285. smalltalk.method({
  2286. selector: "year",
  2287. category: 'accessing',
  2288. fn: function () {
  2289. var self = this;
  2290. return self.getFullYear();
  2291. return self;
  2292. },
  2293. args: [],
  2294. source: "year\x0a\x09<return self.getFullYear()>",
  2295. messageSends: [],
  2296. referencedClasses: []
  2297. }),
  2298. smalltalk.Date);
  2299. smalltalk.addMethod(
  2300. "_year_",
  2301. smalltalk.method({
  2302. selector: "year:",
  2303. category: 'accessing',
  2304. fn: function (aNumber) {
  2305. var self = this;
  2306. self.setFullYear(aNumber);
  2307. return self;
  2308. },
  2309. args: ["aNumber"],
  2310. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2311. messageSends: [],
  2312. referencedClasses: []
  2313. }),
  2314. smalltalk.Date);
  2315. smalltalk.addMethod(
  2316. "_fromMilliseconds_",
  2317. smalltalk.method({
  2318. selector: "fromMilliseconds:",
  2319. category: 'instance creation',
  2320. fn: function (aNumber) {
  2321. var self = this;
  2322. var $1;
  2323. $1 = smalltalk.send(self, "_new_", [aNumber]);
  2324. return $1;
  2325. },
  2326. args: ["aNumber"],
  2327. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2328. messageSends: ["new:"],
  2329. referencedClasses: []
  2330. }),
  2331. smalltalk.Date.klass);
  2332. smalltalk.addMethod(
  2333. "_fromSeconds_",
  2334. smalltalk.method({
  2335. selector: "fromSeconds:",
  2336. category: 'instance creation',
  2337. fn: function (aNumber) {
  2338. var self = this;
  2339. var $1;
  2340. $1 = smalltalk.send(self, "_fromMilliseconds_", [smalltalk.send(aNumber, "__star", [1000])]);
  2341. return $1;
  2342. },
  2343. args: ["aNumber"],
  2344. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2345. messageSends: ["fromMilliseconds:", "*"],
  2346. referencedClasses: []
  2347. }),
  2348. smalltalk.Date.klass);
  2349. smalltalk.addMethod(
  2350. "_fromString_",
  2351. smalltalk.method({
  2352. selector: "fromString:",
  2353. category: 'instance creation',
  2354. fn: function (aString) {
  2355. var self = this;
  2356. var $1;
  2357. $1 = smalltalk.send(self, "_new_", [aString]);
  2358. return $1;
  2359. },
  2360. args: ["aString"],
  2361. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2362. messageSends: ["new:"],
  2363. referencedClasses: []
  2364. }),
  2365. smalltalk.Date.klass);
  2366. smalltalk.addMethod(
  2367. "_millisecondsToRun_",
  2368. smalltalk.method({
  2369. selector: "millisecondsToRun:",
  2370. category: 'instance creation',
  2371. fn: function (aBlock) {
  2372. var self = this;
  2373. var $1;
  2374. var t;
  2375. t = smalltalk.send(smalltalk.Date || Date, "_now", []);
  2376. smalltalk.send(aBlock, "_value", []);
  2377. $1 = smalltalk.send(smalltalk.send(smalltalk.Date || Date, "_now", []), "__minus", [t]);
  2378. return $1;
  2379. },
  2380. args: ["aBlock"],
  2381. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2382. messageSends: ["now", "value", "-"],
  2383. referencedClasses: ["Date"]
  2384. }),
  2385. smalltalk.Date.klass);
  2386. smalltalk.addMethod(
  2387. "_new_",
  2388. smalltalk.method({
  2389. selector: "new:",
  2390. category: 'instance creation',
  2391. fn: function (anObject) {
  2392. var self = this;
  2393. return new Date(anObject);
  2394. return self;
  2395. },
  2396. args: ["anObject"],
  2397. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2398. messageSends: [],
  2399. referencedClasses: []
  2400. }),
  2401. smalltalk.Date.klass);
  2402. smalltalk.addMethod(
  2403. "_now",
  2404. smalltalk.method({
  2405. selector: "now",
  2406. category: 'instance creation',
  2407. fn: function () {
  2408. var self = this;
  2409. var $1;
  2410. $1 = smalltalk.send(self, "_today", []);
  2411. return $1;
  2412. },
  2413. args: [],
  2414. source: "now\x0a\x09^self today",
  2415. messageSends: ["today"],
  2416. referencedClasses: []
  2417. }),
  2418. smalltalk.Date.klass);
  2419. smalltalk.addMethod(
  2420. "_today",
  2421. smalltalk.method({
  2422. selector: "today",
  2423. category: 'instance creation',
  2424. fn: function () {
  2425. var self = this;
  2426. var $1;
  2427. $1 = smalltalk.send(self, "_new", []);
  2428. return $1;
  2429. },
  2430. args: [],
  2431. source: "today\x0a\x09^self new",
  2432. messageSends: ["new"],
  2433. referencedClasses: []
  2434. }),
  2435. smalltalk.Date.klass);
  2436. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  2437. 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`."
  2438. smalltalk.addMethod(
  2439. "_at_",
  2440. smalltalk.method({
  2441. selector: "at:",
  2442. category: 'accessing',
  2443. fn: function (aSymbol) {
  2444. var self = this;
  2445. var attr;
  2446. attr = smalltalk.send(aSymbol, "_asString", []);
  2447. return self['@jsObject'][attr];
  2448. return self;
  2449. },
  2450. args: ["aSymbol"],
  2451. source: "at: aSymbol\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<return self['@jsObject'][attr]>",
  2452. messageSends: ["asString"],
  2453. referencedClasses: []
  2454. }),
  2455. smalltalk.JSObjectProxy);
  2456. smalltalk.addMethod(
  2457. "_at_put_",
  2458. smalltalk.method({
  2459. selector: "at:put:",
  2460. category: 'accessing',
  2461. fn: function (aSymbol, anObject) {
  2462. var self = this;
  2463. var attr;
  2464. attr = smalltalk.send(aSymbol, "_asString", []);
  2465. self['@jsObject'][attr] = anObject;
  2466. return self;
  2467. },
  2468. args: ["aSymbol", "anObject"],
  2469. source: "at: aSymbol put: anObject\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<self['@jsObject'][attr] = anObject>",
  2470. messageSends: ["asString"],
  2471. referencedClasses: []
  2472. }),
  2473. smalltalk.JSObjectProxy);
  2474. smalltalk.addMethod(
  2475. "_doesNotUnderstand_",
  2476. smalltalk.method({
  2477. selector: "doesNotUnderstand:",
  2478. category: 'proxy',
  2479. fn: function (aMessage) {
  2480. var self = this;
  2481. var obj;
  2482. var selector;
  2483. var jsSelector;
  2484. var arguments;
  2485. obj = smalltalk.send(self, "_jsObject", []);
  2486. selector = smalltalk.send(aMessage, "_selector", []);
  2487. jsSelector = smalltalk.send(selector, "_asJavaScriptSelector", []);
  2488. arguments = smalltalk.send(aMessage, "_arguments", []);
  2489. if (obj[jsSelector] != undefined) {
  2490. return smalltalk.send(obj, jsSelector, arguments);
  2491. }
  2492. smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.Object);
  2493. return self;
  2494. },
  2495. args: ["aMessage"],
  2496. 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",
  2497. messageSends: ["jsObject", "selector", "asJavaScriptSelector", "arguments", "doesNotUnderstand:"],
  2498. referencedClasses: []
  2499. }),
  2500. smalltalk.JSObjectProxy);
  2501. smalltalk.addMethod(
  2502. "_inspectOn_",
  2503. smalltalk.method({
  2504. selector: "inspectOn:",
  2505. category: 'proxy',
  2506. fn: function (anInspector) {
  2507. var self = this;
  2508. var variables;
  2509. variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  2510. smalltalk.send(variables, "_at_put_", ["#self", smalltalk.send(self, "_jsObject", [])]);
  2511. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  2512. for (var i in self['@jsObject']) {
  2513. variables._at_put_(i, self['@jsObject'][i]);
  2514. }
  2515. smalltalk.send(anInspector, "_setVariables_", [variables]);
  2516. return self;
  2517. },
  2518. args: ["anInspector"],
  2519. 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",
  2520. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "setVariables:"],
  2521. referencedClasses: ["Dictionary"]
  2522. }),
  2523. smalltalk.JSObjectProxy);
  2524. smalltalk.addMethod(
  2525. "_jsObject",
  2526. smalltalk.method({
  2527. selector: "jsObject",
  2528. category: 'accessing',
  2529. fn: function () {
  2530. var self = this;
  2531. return self['@jsObject'];
  2532. },
  2533. args: [],
  2534. source: "jsObject\x0a\x09^jsObject",
  2535. messageSends: [],
  2536. referencedClasses: []
  2537. }),
  2538. smalltalk.JSObjectProxy);
  2539. smalltalk.addMethod(
  2540. "_jsObject_",
  2541. smalltalk.method({
  2542. selector: "jsObject:",
  2543. category: 'accessing',
  2544. fn: function (aJSObject) {
  2545. var self = this;
  2546. self['@jsObject'] = aJSObject;
  2547. return self;
  2548. },
  2549. args: ["aJSObject"],
  2550. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  2551. messageSends: [],
  2552. referencedClasses: []
  2553. }),
  2554. smalltalk.JSObjectProxy);
  2555. smalltalk.addMethod(
  2556. "_printString",
  2557. smalltalk.method({
  2558. selector: "printString",
  2559. category: 'proxy',
  2560. fn: function () {
  2561. var self = this;
  2562. var $1;
  2563. $1 = smalltalk.send(smalltalk.send(self, "_jsObject", []), "_toString", []);
  2564. return $1;
  2565. },
  2566. args: [],
  2567. source: "printString\x0a\x09^self jsObject toString",
  2568. messageSends: ["toString", "jsObject"],
  2569. referencedClasses: []
  2570. }),
  2571. smalltalk.JSObjectProxy);
  2572. smalltalk.addMethod(
  2573. "_on_",
  2574. smalltalk.method({
  2575. selector: "on:",
  2576. category: 'instance creation',
  2577. fn: function (aJSObject) {
  2578. var self = this;
  2579. var $2, $3, $1;
  2580. $2 = smalltalk.send(self, "_new", []);
  2581. smalltalk.send($2, "_jsObject_", [aJSObject]);
  2582. $3 = smalltalk.send($2, "_yourself", []);
  2583. $1 = $3;
  2584. return $1;
  2585. },
  2586. args: ["aJSObject"],
  2587. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  2588. messageSends: ["jsObject:", "new", "yourself"],
  2589. referencedClasses: []
  2590. }),
  2591. smalltalk.JSObjectProxy.klass);
  2592. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  2593. 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]."
  2594. smalltalk.addMethod(
  2595. "_&",
  2596. smalltalk.method({
  2597. selector: "&",
  2598. category: 'converting',
  2599. fn: function (aNumber) {
  2600. var self = this;
  2601. return self & aNumber;
  2602. return self;
  2603. },
  2604. args: ["aNumber"],
  2605. source: "& aNumber\x0a\x09<return self & aNumber>",
  2606. messageSends: [],
  2607. referencedClasses: []
  2608. }),
  2609. smalltalk.Number);
  2610. smalltalk.addMethod(
  2611. "__star",
  2612. smalltalk.method({
  2613. selector: "*",
  2614. category: 'arithmetic',
  2615. fn: function (aNumber) {
  2616. var self = this;
  2617. return self * aNumber;
  2618. return self;
  2619. },
  2620. args: ["aNumber"],
  2621. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  2622. messageSends: [],
  2623. referencedClasses: []
  2624. }),
  2625. smalltalk.Number);
  2626. smalltalk.addMethod(
  2627. "__plus",
  2628. smalltalk.method({
  2629. selector: "+",
  2630. category: 'arithmetic',
  2631. fn: function (aNumber) {
  2632. var self = this;
  2633. return self + aNumber;
  2634. return self;
  2635. },
  2636. args: ["aNumber"],
  2637. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  2638. messageSends: [],
  2639. referencedClasses: []
  2640. }),
  2641. smalltalk.Number);
  2642. smalltalk.addMethod(
  2643. "__minus",
  2644. smalltalk.method({
  2645. selector: "-",
  2646. category: 'arithmetic',
  2647. fn: function (aNumber) {
  2648. var self = this;
  2649. return self - aNumber;
  2650. return self;
  2651. },
  2652. args: ["aNumber"],
  2653. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  2654. messageSends: [],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.Number);
  2658. smalltalk.addMethod(
  2659. "__slash",
  2660. smalltalk.method({
  2661. selector: "/",
  2662. category: 'arithmetic',
  2663. fn: function (aNumber) {
  2664. var self = this;
  2665. return self / aNumber;
  2666. return self;
  2667. },
  2668. args: ["aNumber"],
  2669. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  2670. messageSends: [],
  2671. referencedClasses: []
  2672. }),
  2673. smalltalk.Number);
  2674. smalltalk.addMethod(
  2675. "__lt",
  2676. smalltalk.method({
  2677. selector: "<",
  2678. category: 'comparing',
  2679. fn: function (aNumber) {
  2680. var self = this;
  2681. return self < aNumber;
  2682. return self;
  2683. },
  2684. args: ["aNumber"],
  2685. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  2686. messageSends: [],
  2687. referencedClasses: []
  2688. }),
  2689. smalltalk.Number);
  2690. smalltalk.addMethod(
  2691. "__lt_eq",
  2692. smalltalk.method({
  2693. selector: "<=",
  2694. category: 'comparing',
  2695. fn: function (aNumber) {
  2696. var self = this;
  2697. return self <= aNumber;
  2698. return self;
  2699. },
  2700. args: ["aNumber"],
  2701. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  2702. messageSends: [],
  2703. referencedClasses: []
  2704. }),
  2705. smalltalk.Number);
  2706. smalltalk.addMethod(
  2707. "__eq",
  2708. smalltalk.method({
  2709. selector: "=",
  2710. category: 'comparing',
  2711. fn: function (aNumber) {
  2712. var self = this;
  2713. var $1;
  2714. $1 = smalltalk.send(aNumber, "_isNumber", []);
  2715. if (!smalltalk.assert($1)) {
  2716. return false;
  2717. }
  2718. return Number(self) == aNumber;
  2719. return self;
  2720. },
  2721. args: ["aNumber"],
  2722. source: "= aNumber\x0a\x09aNumber isNumber ifFalse: [^false]. \x0a\x09<return Number(self) == aNumber>",
  2723. messageSends: ["ifFalse:", "isNumber"],
  2724. referencedClasses: []
  2725. }),
  2726. smalltalk.Number);
  2727. smalltalk.addMethod(
  2728. "__gt",
  2729. smalltalk.method({
  2730. selector: ">",
  2731. category: 'comparing',
  2732. fn: function (aNumber) {
  2733. var self = this;
  2734. return self > aNumber;
  2735. return self;
  2736. },
  2737. args: ["aNumber"],
  2738. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  2739. messageSends: [],
  2740. referencedClasses: []
  2741. }),
  2742. smalltalk.Number);
  2743. smalltalk.addMethod(
  2744. "__gt_eq",
  2745. smalltalk.method({
  2746. selector: ">=",
  2747. category: 'comparing',
  2748. fn: function (aNumber) {
  2749. var self = this;
  2750. return self >= aNumber;
  2751. return self;
  2752. },
  2753. args: ["aNumber"],
  2754. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  2755. messageSends: [],
  2756. referencedClasses: []
  2757. }),
  2758. smalltalk.Number);
  2759. smalltalk.addMethod(
  2760. "__at",
  2761. smalltalk.method({
  2762. selector: "@",
  2763. category: 'converting',
  2764. fn: function (aNumber) {
  2765. var self = this;
  2766. var $1;
  2767. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, aNumber]);
  2768. return $1;
  2769. },
  2770. args: ["aNumber"],
  2771. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  2772. messageSends: ["x:y:"],
  2773. referencedClasses: ["Point"]
  2774. }),
  2775. smalltalk.Number);
  2776. smalltalk.addMethod(
  2777. "_\x5c\x5c",
  2778. smalltalk.method({
  2779. selector: "\x5c\x5c",
  2780. category: 'arithmetic',
  2781. fn: function (aNumber) {
  2782. var self = this;
  2783. return self % aNumber;
  2784. return self;
  2785. },
  2786. args: ["aNumber"],
  2787. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  2788. messageSends: [],
  2789. referencedClasses: []
  2790. }),
  2791. smalltalk.Number);
  2792. smalltalk.addMethod(
  2793. "_abs",
  2794. smalltalk.method({
  2795. selector: "abs",
  2796. category: 'arithmetic',
  2797. fn: function () {
  2798. var self = this;
  2799. var $1;
  2800. $1 = Math.abs(self);
  2801. return $1;
  2802. },
  2803. args: [],
  2804. source: "abs\x0a\x09^ <Math.abs(self);>",
  2805. messageSends: [],
  2806. referencedClasses: []
  2807. }),
  2808. smalltalk.Number);
  2809. smalltalk.addMethod(
  2810. "_asJSON",
  2811. smalltalk.method({
  2812. selector: "asJSON",
  2813. category: 'converting',
  2814. fn: function () {
  2815. var self = this;
  2816. return self;
  2817. },
  2818. args: [],
  2819. source: "asJSON\x0a\x09^self",
  2820. messageSends: [],
  2821. referencedClasses: []
  2822. }),
  2823. smalltalk.Number);
  2824. smalltalk.addMethod(
  2825. "_asJavascript",
  2826. smalltalk.method({
  2827. selector: "asJavascript",
  2828. category: 'converting',
  2829. fn: function () {
  2830. var self = this;
  2831. var $1;
  2832. $1 = smalltalk.send(smalltalk.send("(", "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [")"]);
  2833. return $1;
  2834. },
  2835. args: [],
  2836. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  2837. messageSends: [",", "printString"],
  2838. referencedClasses: []
  2839. }),
  2840. smalltalk.Number);
  2841. smalltalk.addMethod(
  2842. "_asPoint",
  2843. smalltalk.method({
  2844. selector: "asPoint",
  2845. category: 'converting',
  2846. fn: function () {
  2847. var self = this;
  2848. var $1;
  2849. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, self]);
  2850. return $1;
  2851. },
  2852. args: [],
  2853. source: "asPoint\x0a\x09^Point x: self y: self",
  2854. messageSends: ["x:y:"],
  2855. referencedClasses: ["Point"]
  2856. }),
  2857. smalltalk.Number);
  2858. smalltalk.addMethod(
  2859. "_asString",
  2860. smalltalk.method({
  2861. selector: "asString",
  2862. category: 'converting',
  2863. fn: function () {
  2864. var self = this;
  2865. var $1;
  2866. $1 = smalltalk.send(self, "_printString", []);
  2867. return $1;
  2868. },
  2869. args: [],
  2870. source: "asString\x0a\x09^self printString",
  2871. messageSends: ["printString"],
  2872. referencedClasses: []
  2873. }),
  2874. smalltalk.Number);
  2875. smalltalk.addMethod(
  2876. "_atRandom",
  2877. smalltalk.method({
  2878. selector: "atRandom",
  2879. category: 'converting',
  2880. fn: function () {
  2881. var self = this;
  2882. var $1;
  2883. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Random || Random, "_new", []), "_next", []), "__star", [self]), "_truncated", []), "__plus", [1]);
  2884. return $1;
  2885. },
  2886. args: [],
  2887. source: "atRandom\x0a ^(Random new next * self) truncated + 1",
  2888. messageSends: ["+", "truncated", "*", "next", "new"],
  2889. referencedClasses: ["Random"]
  2890. }),
  2891. smalltalk.Number);
  2892. smalltalk.addMethod(
  2893. "_clearInterval",
  2894. smalltalk.method({
  2895. selector: "clearInterval",
  2896. category: 'timeouts/intervals',
  2897. fn: function () {
  2898. var self = this;
  2899. clearInterval(Number(self));
  2900. return self;
  2901. },
  2902. args: [],
  2903. source: "clearInterval\x0a\x09<clearInterval(Number(self))>",
  2904. messageSends: [],
  2905. referencedClasses: []
  2906. }),
  2907. smalltalk.Number);
  2908. smalltalk.addMethod(
  2909. "_clearTimeout",
  2910. smalltalk.method({
  2911. selector: "clearTimeout",
  2912. category: 'timeouts/intervals',
  2913. fn: function () {
  2914. var self = this;
  2915. clearTimeout(Number(self));
  2916. return self;
  2917. },
  2918. args: [],
  2919. source: "clearTimeout\x0a\x09<clearTimeout(Number(self))>",
  2920. messageSends: [],
  2921. referencedClasses: []
  2922. }),
  2923. smalltalk.Number);
  2924. smalltalk.addMethod(
  2925. "_copy",
  2926. smalltalk.method({
  2927. selector: "copy",
  2928. category: 'copying',
  2929. fn: function () {
  2930. var self = this;
  2931. return self;
  2932. },
  2933. args: [],
  2934. source: "copy\x0a\x09^self",
  2935. messageSends: [],
  2936. referencedClasses: []
  2937. }),
  2938. smalltalk.Number);
  2939. smalltalk.addMethod(
  2940. "_deepCopy",
  2941. smalltalk.method({
  2942. selector: "deepCopy",
  2943. category: 'copying',
  2944. fn: function () {
  2945. var self = this;
  2946. var $1;
  2947. $1 = smalltalk.send(self, "_copy", []);
  2948. return $1;
  2949. },
  2950. args: [],
  2951. source: "deepCopy\x0a\x09^self copy",
  2952. messageSends: ["copy"],
  2953. referencedClasses: []
  2954. }),
  2955. smalltalk.Number);
  2956. smalltalk.addMethod(
  2957. "_even",
  2958. smalltalk.method({
  2959. selector: "even",
  2960. category: 'testing',
  2961. fn: function () {
  2962. var self = this;
  2963. var $1;
  2964. $1 = smalltalk.send(0, "__eq", [smalltalk.send(self, "_\\\\", [2])]);
  2965. return $1;
  2966. },
  2967. args: [],
  2968. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  2969. messageSends: ["=", "\x5c\x5c\x5c\x5c"],
  2970. referencedClasses: []
  2971. }),
  2972. smalltalk.Number);
  2973. smalltalk.addMethod(
  2974. "_identityHash",
  2975. smalltalk.method({
  2976. selector: "identityHash",
  2977. category: 'accessing',
  2978. fn: function () {
  2979. var self = this;
  2980. var $1;
  2981. $1 = smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", ["n"]);
  2982. return $1;
  2983. },
  2984. args: [],
  2985. source: "identityHash\x0a\x09^self asString, 'n'",
  2986. messageSends: [",", "asString"],
  2987. referencedClasses: []
  2988. }),
  2989. smalltalk.Number);
  2990. smalltalk.addMethod(
  2991. "_isNumber",
  2992. smalltalk.method({
  2993. selector: "isNumber",
  2994. category: 'testing',
  2995. fn: function () {
  2996. var self = this;
  2997. return true;
  2998. },
  2999. args: [],
  3000. source: "isNumber\x0a\x09^true",
  3001. messageSends: [],
  3002. referencedClasses: []
  3003. }),
  3004. smalltalk.Number);
  3005. smalltalk.addMethod(
  3006. "_isZero",
  3007. smalltalk.method({
  3008. selector: "isZero",
  3009. category: 'testing',
  3010. fn: function () {
  3011. var self = this;
  3012. var $1;
  3013. $1 = smalltalk.send(self, "__eq", [0]);
  3014. return $1;
  3015. },
  3016. args: [],
  3017. source: "isZero\x0a\x09^self = 0",
  3018. messageSends: ["="],
  3019. referencedClasses: []
  3020. }),
  3021. smalltalk.Number);
  3022. smalltalk.addMethod(
  3023. "_max_",
  3024. smalltalk.method({
  3025. selector: "max:",
  3026. category: 'arithmetic',
  3027. fn: function (aNumber) {
  3028. var self = this;
  3029. return Math.max(self, aNumber);
  3030. return self;
  3031. },
  3032. args: ["aNumber"],
  3033. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3034. messageSends: [],
  3035. referencedClasses: []
  3036. }),
  3037. smalltalk.Number);
  3038. smalltalk.addMethod(
  3039. "_min_",
  3040. smalltalk.method({
  3041. selector: "min:",
  3042. category: 'arithmetic',
  3043. fn: function (aNumber) {
  3044. var self = this;
  3045. return Math.min(self, aNumber);
  3046. return self;
  3047. },
  3048. args: ["aNumber"],
  3049. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3050. messageSends: [],
  3051. referencedClasses: []
  3052. }),
  3053. smalltalk.Number);
  3054. smalltalk.addMethod(
  3055. "_negated",
  3056. smalltalk.method({
  3057. selector: "negated",
  3058. category: 'arithmetic',
  3059. fn: function () {
  3060. var self = this;
  3061. var $1;
  3062. $1 = smalltalk.send(0, "__minus", [self]);
  3063. return $1;
  3064. },
  3065. args: [],
  3066. source: "negated\x0a\x09^0 - self",
  3067. messageSends: ["-"],
  3068. referencedClasses: []
  3069. }),
  3070. smalltalk.Number);
  3071. smalltalk.addMethod(
  3072. "_negative",
  3073. smalltalk.method({
  3074. selector: "negative",
  3075. category: 'testing',
  3076. fn: function () {
  3077. var self = this;
  3078. var $1;
  3079. $1 = smalltalk.send(self, "__lt", [0]);
  3080. return $1;
  3081. },
  3082. args: [],
  3083. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3084. messageSends: ["<"],
  3085. referencedClasses: []
  3086. }),
  3087. smalltalk.Number);
  3088. smalltalk.addMethod(
  3089. "_odd",
  3090. smalltalk.method({
  3091. selector: "odd",
  3092. category: 'testing',
  3093. fn: function () {
  3094. var self = this;
  3095. var $1;
  3096. $1 = smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  3097. return $1;
  3098. },
  3099. args: [],
  3100. source: "odd\x0a\x09^ self even not",
  3101. messageSends: ["not", "even"],
  3102. referencedClasses: []
  3103. }),
  3104. smalltalk.Number);
  3105. smalltalk.addMethod(
  3106. "_positive",
  3107. smalltalk.method({
  3108. selector: "positive",
  3109. category: 'testing',
  3110. fn: function () {
  3111. var self = this;
  3112. var $1;
  3113. $1 = smalltalk.send(self, "__gt_eq", [0]);
  3114. return $1;
  3115. },
  3116. args: [],
  3117. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3118. messageSends: [">="],
  3119. referencedClasses: []
  3120. }),
  3121. smalltalk.Number);
  3122. smalltalk.addMethod(
  3123. "_printShowingDecimalPlaces_",
  3124. smalltalk.method({
  3125. selector: "printShowingDecimalPlaces:",
  3126. category: 'printing',
  3127. fn: function (placesDesired) {
  3128. var self = this;
  3129. return self.toFixed(placesDesired);
  3130. return self;
  3131. },
  3132. args: ["placesDesired"],
  3133. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  3134. messageSends: [],
  3135. referencedClasses: []
  3136. }),
  3137. smalltalk.Number);
  3138. smalltalk.addMethod(
  3139. "_printString",
  3140. smalltalk.method({
  3141. selector: "printString",
  3142. category: 'printing',
  3143. fn: function () {
  3144. var self = this;
  3145. return String(self);
  3146. return self;
  3147. },
  3148. args: [],
  3149. source: "printString\x0a\x09<return String(self)>",
  3150. messageSends: [],
  3151. referencedClasses: []
  3152. }),
  3153. smalltalk.Number);
  3154. smalltalk.addMethod(
  3155. "_rounded",
  3156. smalltalk.method({
  3157. selector: "rounded",
  3158. category: 'converting',
  3159. fn: function () {
  3160. var self = this;
  3161. return Math.round(self);
  3162. return self;
  3163. },
  3164. args: [],
  3165. source: "rounded\x0a\x09<return Math.round(self);>",
  3166. messageSends: [],
  3167. referencedClasses: []
  3168. }),
  3169. smalltalk.Number);
  3170. smalltalk.addMethod(
  3171. "_sqrt",
  3172. smalltalk.method({
  3173. selector: "sqrt",
  3174. category: 'arithmetic',
  3175. fn: function () {
  3176. var self = this;
  3177. return Math.sqrt(self);
  3178. return self;
  3179. },
  3180. args: [],
  3181. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  3182. messageSends: [],
  3183. referencedClasses: []
  3184. }),
  3185. smalltalk.Number);
  3186. smalltalk.addMethod(
  3187. "_squared",
  3188. smalltalk.method({
  3189. selector: "squared",
  3190. category: 'arithmetic',
  3191. fn: function () {
  3192. var self = this;
  3193. var $1;
  3194. $1 = smalltalk.send(self, "__star", [self]);
  3195. return $1;
  3196. },
  3197. args: [],
  3198. source: "squared\x0a\x09^self * self",
  3199. messageSends: ["*"],
  3200. referencedClasses: []
  3201. }),
  3202. smalltalk.Number);
  3203. smalltalk.addMethod(
  3204. "_timesRepeat_",
  3205. smalltalk.method({
  3206. selector: "timesRepeat:",
  3207. category: 'enumerating',
  3208. fn: function (aBlock) {
  3209. var self = this;
  3210. var integer;
  3211. var count;
  3212. integer = smalltalk.send(self, "_truncated", []);
  3213. count = 1;
  3214. smalltalk.send(function () {return smalltalk.send(count, "__gt", [self]);}, "_whileFalse_", [function () {smalltalk.send(aBlock, "_value", []);count = smalltalk.send(count, "__plus", [1]);return count;}]);
  3215. return self;
  3216. },
  3217. args: ["aBlock"],
  3218. 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]",
  3219. messageSends: ["truncated", "whileFalse:", "value", "+", ">"],
  3220. referencedClasses: []
  3221. }),
  3222. smalltalk.Number);
  3223. smalltalk.addMethod(
  3224. "_to_",
  3225. smalltalk.method({
  3226. selector: "to:",
  3227. category: 'converting',
  3228. fn: function (aNumber) {
  3229. var self = this;
  3230. var array;
  3231. var first;
  3232. var last;
  3233. var count;
  3234. first = smalltalk.send(self, "_truncated", []);
  3235. last = smalltalk.send(smalltalk.send(aNumber, "_truncated", []), "__plus", [1]);
  3236. count = 1;
  3237. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3238. smalltalk.send(smalltalk.send(last, "__minus", [first]), "_timesRepeat_", [function () {smalltalk.send(array, "_at_put_", [count, first]);count = smalltalk.send(count, "__plus", [1]);count;first = smalltalk.send(first, "__plus", [1]);return first;}]);
  3239. return array;
  3240. },
  3241. args: ["aNumber"],
  3242. 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",
  3243. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  3244. referencedClasses: ["Array"]
  3245. }),
  3246. smalltalk.Number);
  3247. smalltalk.addMethod(
  3248. "_to_by_",
  3249. smalltalk.method({
  3250. selector: "to:by:",
  3251. category: 'converting',
  3252. fn: function (stop, step) {
  3253. var self = this;
  3254. var $1, $2;
  3255. var array;
  3256. var value;
  3257. var pos;
  3258. value = self;
  3259. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3260. pos = 1;
  3261. $1 = smalltalk.send(step, "__eq", [0]);
  3262. if (smalltalk.assert($1)) {
  3263. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  3264. }
  3265. $2 = smalltalk.send(step, "__lt", [0]);
  3266. if (smalltalk.assert($2)) {
  3267. smalltalk.send(function () {return smalltalk.send(value, "__gt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(array, "_at_put_", [pos, value]);pos = smalltalk.send(pos, "__plus", [1]);pos;value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3268. } else {
  3269. smalltalk.send(function () {return smalltalk.send(value, "__lt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(array, "_at_put_", [pos, value]);pos = smalltalk.send(pos, "__plus", [1]);pos;value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3270. }
  3271. return array;
  3272. },
  3273. args: ["stop", "step"],
  3274. 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",
  3275. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  3276. referencedClasses: ["Array"]
  3277. }),
  3278. smalltalk.Number);
  3279. smalltalk.addMethod(
  3280. "_to_by_do_",
  3281. smalltalk.method({
  3282. selector: "to:by:do:",
  3283. category: 'enumerating',
  3284. fn: function (stop, step, aBlock) {
  3285. var self = this;
  3286. var $1, $2;
  3287. var value;
  3288. value = self;
  3289. $1 = smalltalk.send(step, "__eq", [0]);
  3290. if (smalltalk.assert($1)) {
  3291. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  3292. }
  3293. $2 = smalltalk.send(step, "__lt", [0]);
  3294. if (smalltalk.assert($2)) {
  3295. smalltalk.send(function () {return smalltalk.send(value, "__gt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(aBlock, "_value_", [value]);value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3296. } else {
  3297. smalltalk.send(function () {return smalltalk.send(value, "__lt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(aBlock, "_value_", [value]);value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3298. }
  3299. return self;
  3300. },
  3301. args: ["stop", "step", "aBlock"],
  3302. 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]]",
  3303. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  3304. referencedClasses: []
  3305. }),
  3306. smalltalk.Number);
  3307. smalltalk.addMethod(
  3308. "_to_do_",
  3309. smalltalk.method({
  3310. selector: "to:do:",
  3311. category: 'enumerating',
  3312. fn: function (stop, aBlock) {
  3313. var self = this;
  3314. var nextValue;
  3315. nextValue = self;
  3316. smalltalk.send(function () {return smalltalk.send(nextValue, "__lt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(aBlock, "_value_", [nextValue]);nextValue = smalltalk.send(nextValue, "__plus", [1]);return nextValue;}]);
  3317. return self;
  3318. },
  3319. args: ["stop", "aBlock"],
  3320. 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]",
  3321. messageSends: ["whileTrue:", "value:", "+", "<="],
  3322. referencedClasses: []
  3323. }),
  3324. smalltalk.Number);
  3325. smalltalk.addMethod(
  3326. "_truncated",
  3327. smalltalk.method({
  3328. selector: "truncated",
  3329. category: 'converting',
  3330. fn: function () {
  3331. var self = this;
  3332. var $1;
  3333. var result;
  3334. $1 = smalltalk.send(self, "__gt_eq", [0]);
  3335. if (smalltalk.assert($1)) {
  3336. result = Math.floor(self);
  3337. } else {
  3338. result = Math.floor(self * -1) * -1;
  3339. }
  3340. return result;
  3341. },
  3342. args: [],
  3343. 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",
  3344. messageSends: ["ifTrue:ifFalse:", ">="],
  3345. referencedClasses: []
  3346. }),
  3347. smalltalk.Number);
  3348. smalltalk.addMethod(
  3349. "_|",
  3350. smalltalk.method({
  3351. selector: "|",
  3352. category: 'converting',
  3353. fn: function (aNumber) {
  3354. var self = this;
  3355. return self | aNumber;
  3356. return self;
  3357. },
  3358. args: ["aNumber"],
  3359. source: "| aNumber\x0a\x09<return self | aNumber>",
  3360. messageSends: [],
  3361. referencedClasses: []
  3362. }),
  3363. smalltalk.Number);
  3364. smalltalk.addMethod(
  3365. "_pi",
  3366. smalltalk.method({
  3367. selector: "pi",
  3368. category: 'instance creation',
  3369. fn: function () {
  3370. var self = this;
  3371. return Math.PI;
  3372. return self;
  3373. },
  3374. args: [],
  3375. source: "pi\x0a\x09<return Math.PI>",
  3376. messageSends: [],
  3377. referencedClasses: []
  3378. }),
  3379. smalltalk.Number.klass);
  3380. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  3381. smalltalk.addMethod(
  3382. "_addElement_",
  3383. smalltalk.method({
  3384. selector: "addElement:",
  3385. category: 'accessing',
  3386. fn: function (anObject) {
  3387. var self = this;
  3388. self.addElement(anObject);
  3389. return self;
  3390. },
  3391. args: ["anObject"],
  3392. source: "addElement: anObject\x0a\x09<self.addElement(anObject)>",
  3393. messageSends: [],
  3394. referencedClasses: []
  3395. }),
  3396. smalltalk.Organizer);
  3397. smalltalk.addMethod(
  3398. "_elements",
  3399. smalltalk.method({
  3400. selector: "elements",
  3401. category: 'accessing',
  3402. fn: function () {
  3403. var self = this;
  3404. var $1;
  3405. $1 = smalltalk.send(smalltalk.send(self, "_basicAt_", ["elements"]), "_copy", []);
  3406. return $1;
  3407. },
  3408. args: [],
  3409. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  3410. messageSends: ["copy", "basicAt:"],
  3411. referencedClasses: []
  3412. }),
  3413. smalltalk.Organizer);
  3414. smalltalk.addMethod(
  3415. "_removeElement_",
  3416. smalltalk.method({
  3417. selector: "removeElement:",
  3418. category: 'accessing',
  3419. fn: function (anObject) {
  3420. var self = this;
  3421. self.removeElement(anObject);
  3422. return self;
  3423. },
  3424. args: ["anObject"],
  3425. source: "removeElement: anObject\x0a\x09<self.removeElement(anObject)>",
  3426. messageSends: [],
  3427. referencedClasses: []
  3428. }),
  3429. smalltalk.Organizer);
  3430. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  3431. 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'"
  3432. smalltalk.addMethod(
  3433. "_classes",
  3434. smalltalk.method({
  3435. selector: "classes",
  3436. category: 'classes',
  3437. fn: function () {
  3438. var self = this;
  3439. var $1;
  3440. $1 = smalltalk.send(smalltalk.send(self, "_organization", []), "_elements", []);
  3441. return $1;
  3442. },
  3443. args: [],
  3444. source: "classes\x0a\x09^ self organization elements",
  3445. messageSends: ["elements", "organization"],
  3446. referencedClasses: []
  3447. }),
  3448. smalltalk.Package);
  3449. smalltalk.addMethod(
  3450. "_commitPathJs",
  3451. smalltalk.method({
  3452. selector: "commitPathJs",
  3453. category: 'accessing',
  3454. fn: function () {
  3455. var self = this;
  3456. var $1;
  3457. if (($receiver = self['@commitPathJs']) == nil ||
  3458. $receiver == undefined) {
  3459. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);
  3460. } else {
  3461. $1 = self['@commitPathJs'];
  3462. }
  3463. return $1;
  3464. },
  3465. args: [],
  3466. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  3467. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  3468. referencedClasses: []
  3469. }),
  3470. smalltalk.Package);
  3471. smalltalk.addMethod(
  3472. "_commitPathJs_",
  3473. smalltalk.method({
  3474. selector: "commitPathJs:",
  3475. category: 'accessing',
  3476. fn: function (aString) {
  3477. var self = this;
  3478. self['@commitPathJs'] = aString;
  3479. return self;
  3480. },
  3481. args: ["aString"],
  3482. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  3483. messageSends: [],
  3484. referencedClasses: []
  3485. }),
  3486. smalltalk.Package);
  3487. smalltalk.addMethod(
  3488. "_commitPathSt",
  3489. smalltalk.method({
  3490. selector: "commitPathSt",
  3491. category: 'accessing',
  3492. fn: function () {
  3493. var self = this;
  3494. var $1;
  3495. if (($receiver = self['@commitPathSt']) == nil ||
  3496. $receiver == undefined) {
  3497. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);
  3498. } else {
  3499. $1 = self['@commitPathSt'];
  3500. }
  3501. return $1;
  3502. },
  3503. args: [],
  3504. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  3505. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  3506. referencedClasses: []
  3507. }),
  3508. smalltalk.Package);
  3509. smalltalk.addMethod(
  3510. "_commitPathSt_",
  3511. smalltalk.method({
  3512. selector: "commitPathSt:",
  3513. category: 'accessing',
  3514. fn: function (aString) {
  3515. var self = this;
  3516. self['@commitPathSt'] = aString;
  3517. return self;
  3518. },
  3519. args: ["aString"],
  3520. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  3521. messageSends: [],
  3522. referencedClasses: []
  3523. }),
  3524. smalltalk.Package);
  3525. smalltalk.addMethod(
  3526. "_dependencies",
  3527. smalltalk.method({
  3528. selector: "dependencies",
  3529. category: 'accessing',
  3530. fn: function () {
  3531. var self = this;
  3532. var $1;
  3533. $1 = smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", function () {return [];}]);
  3534. return $1;
  3535. },
  3536. args: [],
  3537. source: "dependencies\x0a\x09^self propertyAt: 'dependencies' ifAbsent: [#()]",
  3538. messageSends: ["propertyAt:ifAbsent:"],
  3539. referencedClasses: []
  3540. }),
  3541. smalltalk.Package);
  3542. smalltalk.addMethod(
  3543. "_dependencies_",
  3544. smalltalk.method({
  3545. selector: "dependencies:",
  3546. category: 'accessing',
  3547. fn: function (anArray) {
  3548. var self = this;
  3549. var $1;
  3550. $1 = smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  3551. return $1;
  3552. },
  3553. args: ["anArray"],
  3554. source: "dependencies: anArray\x0a\x09^self propertyAt: 'dependencies' put: anArray",
  3555. messageSends: ["propertyAt:put:"],
  3556. referencedClasses: []
  3557. }),
  3558. smalltalk.Package);
  3559. smalltalk.addMethod(
  3560. "_jsProperties",
  3561. smalltalk.method({
  3562. selector: "jsProperties",
  3563. category: 'private',
  3564. fn: function () {
  3565. var self = this;
  3566. return self.properties;
  3567. return self;
  3568. },
  3569. args: [],
  3570. source: "jsProperties\x0a\x09<return self.properties>",
  3571. messageSends: [],
  3572. referencedClasses: []
  3573. }),
  3574. smalltalk.Package);
  3575. smalltalk.addMethod(
  3576. "_jsProperties_",
  3577. smalltalk.method({
  3578. selector: "jsProperties:",
  3579. category: 'private',
  3580. fn: function (aJSObject) {
  3581. var self = this;
  3582. return self.properties = aJSObject;
  3583. return self;
  3584. },
  3585. args: ["aJSObject"],
  3586. source: "jsProperties: aJSObject\x0a\x09<return self.properties = aJSObject>",
  3587. messageSends: [],
  3588. referencedClasses: []
  3589. }),
  3590. smalltalk.Package);
  3591. smalltalk.addMethod(
  3592. "_name",
  3593. smalltalk.method({
  3594. selector: "name",
  3595. category: 'accessing',
  3596. fn: function () {
  3597. var self = this;
  3598. return self.pkgName;
  3599. return self;
  3600. },
  3601. args: [],
  3602. source: "name\x0a\x09<return self.pkgName>",
  3603. messageSends: [],
  3604. referencedClasses: []
  3605. }),
  3606. smalltalk.Package);
  3607. smalltalk.addMethod(
  3608. "_name_",
  3609. smalltalk.method({
  3610. selector: "name:",
  3611. category: 'accessing',
  3612. fn: function (aString) {
  3613. var self = this;
  3614. self.pkgName = aString;
  3615. return self;
  3616. },
  3617. args: ["aString"],
  3618. source: "name: aString\x0a\x09<self.pkgName = aString>",
  3619. messageSends: [],
  3620. referencedClasses: []
  3621. }),
  3622. smalltalk.Package);
  3623. smalltalk.addMethod(
  3624. "_organization",
  3625. smalltalk.method({
  3626. selector: "organization",
  3627. category: 'accessing',
  3628. fn: function () {
  3629. var self = this;
  3630. var $1;
  3631. $1 = smalltalk.send(self, "_basicAt_", ["organization"]);
  3632. return $1;
  3633. },
  3634. args: [],
  3635. source: "organization\x0a\x09^ self basicAt: 'organization'",
  3636. messageSends: ["basicAt:"],
  3637. referencedClasses: []
  3638. }),
  3639. smalltalk.Package);
  3640. smalltalk.addMethod(
  3641. "_printString",
  3642. smalltalk.method({
  3643. selector: "printString",
  3644. category: 'printing',
  3645. fn: function () {
  3646. var self = this;
  3647. var $1;
  3648. $1 = smalltalk.send(self, "_name", []);
  3649. return $1;
  3650. },
  3651. args: [],
  3652. source: "printString\x0a\x09^self name",
  3653. messageSends: ["name"],
  3654. referencedClasses: []
  3655. }),
  3656. smalltalk.Package);
  3657. smalltalk.addMethod(
  3658. "_properties",
  3659. smalltalk.method({
  3660. selector: "properties",
  3661. category: 'accessing',
  3662. fn: function () {
  3663. var self = this;
  3664. var $1;
  3665. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  3666. return $1;
  3667. },
  3668. args: [],
  3669. source: "properties\x0a\x09^Smalltalk current readJSObject: (self basicAt: 'properties')",
  3670. messageSends: ["readJSObject:", "basicAt:", "current"],
  3671. referencedClasses: ["Smalltalk"]
  3672. }),
  3673. smalltalk.Package);
  3674. smalltalk.addMethod(
  3675. "_properties_",
  3676. smalltalk.method({
  3677. selector: "properties:",
  3678. category: 'accessing',
  3679. fn: function (aDict) {
  3680. var self = this;
  3681. var object;
  3682. object = {};
  3683. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  3684. return self.properties = object;
  3685. return self;
  3686. },
  3687. args: ["aDict"],
  3688. 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>",
  3689. messageSends: ["keysAndValuesDo:"],
  3690. referencedClasses: []
  3691. }),
  3692. smalltalk.Package);
  3693. smalltalk.addMethod(
  3694. "_propertiesAsJSON",
  3695. smalltalk.method({
  3696. selector: "propertiesAsJSON",
  3697. category: 'private',
  3698. fn: function () {
  3699. var self = this;
  3700. return JSON.stringify(self.properties);
  3701. return self;
  3702. },
  3703. args: [],
  3704. source: "propertiesAsJSON\x0a\x09<return JSON.stringify(self.properties)>",
  3705. messageSends: [],
  3706. referencedClasses: []
  3707. }),
  3708. smalltalk.Package);
  3709. smalltalk.addMethod(
  3710. "_propertyAt_",
  3711. smalltalk.method({
  3712. selector: "propertyAt:",
  3713. category: 'properties',
  3714. fn: function (key) {
  3715. var self = this;
  3716. return self.properties[key];
  3717. return self;
  3718. },
  3719. args: ["key"],
  3720. source: "propertyAt: key\x0a\x0a\x09<return self.properties[key]>",
  3721. messageSends: [],
  3722. referencedClasses: []
  3723. }),
  3724. smalltalk.Package);
  3725. smalltalk.addMethod(
  3726. "_propertyAt_ifAbsent_",
  3727. smalltalk.method({
  3728. selector: "propertyAt:ifAbsent:",
  3729. category: 'properties',
  3730. fn: function (key, block) {
  3731. var self = this;
  3732. var $2, $1;
  3733. $2 = smalltalk.send(self, "_propertyAt_", [key]);
  3734. if (($receiver = $2) == nil || $receiver == undefined) {
  3735. $1 = smalltalk.send(block, "_value", []);
  3736. } else {
  3737. $1 = $2;
  3738. }
  3739. return $1;
  3740. },
  3741. args: ["key", "block"],
  3742. source: "propertyAt: key ifAbsent: block\x0a\x0a\x09^(self propertyAt: key) ifNil: [block value]",
  3743. messageSends: ["ifNil:", "value", "propertyAt:"],
  3744. referencedClasses: []
  3745. }),
  3746. smalltalk.Package);
  3747. smalltalk.addMethod(
  3748. "_propertyAt_put_",
  3749. smalltalk.method({
  3750. selector: "propertyAt:put:",
  3751. category: 'properties',
  3752. fn: function (key, value) {
  3753. var self = this;
  3754. return self.properties[key] = value;
  3755. return self;
  3756. },
  3757. args: ["key", "value"],
  3758. source: "propertyAt: key put: value\x0a\x0a\x09<return self.properties[key] = value>",
  3759. messageSends: [],
  3760. referencedClasses: []
  3761. }),
  3762. smalltalk.Package);
  3763. smalltalk.addMethod(
  3764. "_sortedClasses",
  3765. smalltalk.method({
  3766. selector: "sortedClasses",
  3767. category: 'classes',
  3768. fn: function () {
  3769. var self = this;
  3770. var $1;
  3771. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  3772. return $1;
  3773. },
  3774. args: [],
  3775. 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",
  3776. messageSends: ["sortedClasses:", "classes", "class"],
  3777. referencedClasses: []
  3778. }),
  3779. smalltalk.Package);
  3780. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  3781. smalltalk.addMethod(
  3782. "_commitToLocalStorage_",
  3783. smalltalk.method({
  3784. selector: "commitToLocalStorage:",
  3785. category: 'loading-storing',
  3786. fn: function (aPackageName) {
  3787. var self = this;
  3788. var key;
  3789. var sourceCode;
  3790. key = smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]);
  3791. sourceCode = smalltalk.send(smalltalk.send(smalltalk.Exporter || Exporter, "_new", []), "_exportPackage_", [aPackageName]);
  3792. localStorage[key] = escape(sourceCode);
  3793. return self;
  3794. },
  3795. args: ["aPackageName"],
  3796. source: "commitToLocalStorage: aPackageName\x0a\x09| key sourceCode |\x0a\x09key := 'smalltalk.packages.' , aPackageName.\x0a\x09sourceCode := Exporter new exportPackage: aPackageName.\x0a\x09<localStorage[key] = escape(sourceCode)>",
  3797. messageSends: [",", "exportPackage:", "new"],
  3798. referencedClasses: ["Exporter"]
  3799. }),
  3800. smalltalk.Package.klass);
  3801. smalltalk.addMethod(
  3802. "_defaultCommitPathJs",
  3803. smalltalk.method({
  3804. selector: "defaultCommitPathJs",
  3805. category: 'commit paths',
  3806. fn: function () {
  3807. var self = this;
  3808. var $1;
  3809. if (($receiver = self['@defaultCommitPathJs']) == nil ||
  3810. $receiver == undefined) {
  3811. self['@defaultCommitPathJs'] = "js";
  3812. $1 = self['@defaultCommitPathJs'];
  3813. } else {
  3814. $1 = self['@defaultCommitPathJs'];
  3815. }
  3816. return $1;
  3817. },
  3818. args: [],
  3819. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  3820. messageSends: ["ifNil:"],
  3821. referencedClasses: []
  3822. }),
  3823. smalltalk.Package.klass);
  3824. smalltalk.addMethod(
  3825. "_defaultCommitPathJs_",
  3826. smalltalk.method({
  3827. selector: "defaultCommitPathJs:",
  3828. category: 'commit paths',
  3829. fn: function (aString) {
  3830. var self = this;
  3831. self['@defaultCommitPathJs'] = aString;
  3832. return self;
  3833. },
  3834. args: ["aString"],
  3835. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  3836. messageSends: [],
  3837. referencedClasses: []
  3838. }),
  3839. smalltalk.Package.klass);
  3840. smalltalk.addMethod(
  3841. "_defaultCommitPathSt",
  3842. smalltalk.method({
  3843. selector: "defaultCommitPathSt",
  3844. category: 'commit paths',
  3845. fn: function () {
  3846. var self = this;
  3847. var $1;
  3848. if (($receiver = self['@defaultCommitPathSt']) == nil ||
  3849. $receiver == undefined) {
  3850. self['@defaultCommitPathSt'] = "st";
  3851. $1 = self['@defaultCommitPathSt'];
  3852. } else {
  3853. $1 = self['@defaultCommitPathSt'];
  3854. }
  3855. return $1;
  3856. },
  3857. args: [],
  3858. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  3859. messageSends: ["ifNil:"],
  3860. referencedClasses: []
  3861. }),
  3862. smalltalk.Package.klass);
  3863. smalltalk.addMethod(
  3864. "_defaultCommitPathSt_",
  3865. smalltalk.method({
  3866. selector: "defaultCommitPathSt:",
  3867. category: 'commit paths',
  3868. fn: function (aString) {
  3869. var self = this;
  3870. self['@defaultCommitPathSt'] = aString;
  3871. return self;
  3872. },
  3873. args: ["aString"],
  3874. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  3875. messageSends: [],
  3876. referencedClasses: []
  3877. }),
  3878. smalltalk.Package.klass);
  3879. smalltalk.addMethod(
  3880. "_fetch_",
  3881. smalltalk.method({
  3882. selector: "fetch:",
  3883. category: 'loading-storing',
  3884. fn: function (aPackageName) {
  3885. var self = this;
  3886. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  3887. return self;
  3888. },
  3889. args: ["aPackageName"],
  3890. source: "fetch: aPackageName\x0a\x09self fetch: aPackageName prefix: self defaultCommitPathJs, '/'",
  3891. messageSends: ["fetch:prefix:", ",", "defaultCommitPathJs"],
  3892. referencedClasses: []
  3893. }),
  3894. smalltalk.Package.klass);
  3895. smalltalk.addMethod(
  3896. "_fetch_prefix_",
  3897. smalltalk.method({
  3898. selector: "fetch:prefix:",
  3899. category: 'loading-storing',
  3900. fn: function (aPackageName, aPrefix) {
  3901. var self = this;
  3902. smalltalk.send(jQuery, "_getScript_onSuccess_", [smalltalk.send(smalltalk.send(aPrefix, "__comma", [aPackageName]), "__comma", [".js"]), function () {return smalltalk.send(smalltalk.Package || Package, "_init_", [aPackageName]);}]);
  3903. return self;
  3904. },
  3905. args: ["aPackageName", "aPrefix"],
  3906. source: "fetch: aPackageName prefix: aPrefix\x0a\x09jQuery getScript: (aPrefix , aPackageName , '.js') onSuccess: [ Package init: aPackageName ]",
  3907. messageSends: ["getScript:onSuccess:", ",", "init:"],
  3908. referencedClasses: ["Package"]
  3909. }),
  3910. smalltalk.Package.klass);
  3911. smalltalk.addMethod(
  3912. "_init_",
  3913. smalltalk.method({
  3914. selector: "init:",
  3915. category: 'loading-storing',
  3916. fn: function (aPackageName) {
  3917. var self = this;
  3918. var $1, $2;
  3919. $1 = smalltalk.send(smalltalk.send(smalltalk, "_classes", []), "_select_", [function (each) {return each.pkg.pkgName == aPackageName;}]);
  3920. smalltalk.send($1, "_do_", [function (each) {return smalltalk.init(each);}]);
  3921. $2 = smalltalk.send($1, "_do_", [function (each) {return smalltalk.send(each, "_initialize", []);}]);
  3922. return self;
  3923. },
  3924. args: ["aPackageName"],
  3925. 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 ]",
  3926. messageSends: ["do:", "select:", "classes", "initialize"],
  3927. referencedClasses: []
  3928. }),
  3929. smalltalk.Package.klass);
  3930. smalltalk.addMethod(
  3931. "_named_",
  3932. smalltalk.method({
  3933. selector: "named:",
  3934. category: 'not yet classified',
  3935. fn: function (aPackageName) {
  3936. var self = this;
  3937. var $1;
  3938. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_", [aPackageName]);
  3939. return $1;
  3940. },
  3941. args: ["aPackageName"],
  3942. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  3943. messageSends: ["packageAt:", "current"],
  3944. referencedClasses: ["Smalltalk"]
  3945. }),
  3946. smalltalk.Package.klass);
  3947. smalltalk.addMethod(
  3948. "_named_ifAbsent_",
  3949. smalltalk.method({
  3950. selector: "named:ifAbsent:",
  3951. category: 'not yet classified',
  3952. fn: function (aPackageName, aBlock) {
  3953. var self = this;
  3954. var $1;
  3955. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  3956. return $1;
  3957. },
  3958. args: ["aPackageName", "aBlock"],
  3959. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  3960. messageSends: ["packageAt:ifAbsent:", "current"],
  3961. referencedClasses: ["Smalltalk"]
  3962. }),
  3963. smalltalk.Package.klass);
  3964. smalltalk.addMethod(
  3965. "_resetCommitPaths",
  3966. smalltalk.method({
  3967. selector: "resetCommitPaths",
  3968. category: 'commit paths',
  3969. fn: function () {
  3970. var self = this;
  3971. self['@defaultCommitPathJs'] = nil;
  3972. self['@defaultCommitPathSt'] = nil;
  3973. return self;
  3974. },
  3975. args: [],
  3976. source: "resetCommitPaths\x0a defaultCommitPathJs := nil.\x0a defaultCommitPathSt := nil.",
  3977. messageSends: [],
  3978. referencedClasses: []
  3979. }),
  3980. smalltalk.Package.klass);
  3981. smalltalk.addMethod(
  3982. "_sortedClasses_",
  3983. smalltalk.method({
  3984. selector: "sortedClasses:",
  3985. category: 'sorting',
  3986. fn: function (classes) {
  3987. var self = this;
  3988. var $1;
  3989. var children;
  3990. var others;
  3991. var nodes;
  3992. var expandedClasses;
  3993. children = [];
  3994. others = [];
  3995. smalltalk.send(classes, "_do_", [function (each) {$1 = smalltalk.send(classes, "_includes_", [smalltalk.send(each, "_superclass", [])]);if (smalltalk.assert($1)) {return smalltalk.send(others, "_add_", [each]);} else {return smalltalk.send(children, "_add_", [each]);}}]);
  3996. nodes = smalltalk.send(children, "_collect_", [function (each) {return smalltalk.send(smalltalk.ClassSorterNode || ClassSorterNode, "_on_classes_level_", [each, others, 0]);}]);
  3997. nodes = smalltalk.send(nodes, "_sorted_", [function (a, b) {return smalltalk.send(smalltalk.send(smalltalk.send(a, "_theClass", []), "_name", []), "__lt_eq", [smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", [])]);}]);
  3998. expandedClasses = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3999. smalltalk.send(nodes, "_do_", [function (aNode) {return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);}]);
  4000. return expandedClasses;
  4001. },
  4002. args: ["classes"],
  4003. 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",
  4004. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  4005. referencedClasses: ["ClassSorterNode", "Array"]
  4006. }),
  4007. smalltalk.Package.klass);
  4008. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  4009. 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."
  4010. smalltalk.addMethod(
  4011. "__star",
  4012. smalltalk.method({
  4013. selector: "*",
  4014. category: 'arithmetic',
  4015. fn: function (aPoint) {
  4016. var self = this;
  4017. var $1;
  4018. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4019. return $1;
  4020. },
  4021. args: ["aPoint"],
  4022. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4023. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4024. referencedClasses: ["Point"]
  4025. }),
  4026. smalltalk.Point);
  4027. smalltalk.addMethod(
  4028. "__plus",
  4029. smalltalk.method({
  4030. selector: "+",
  4031. category: 'arithmetic',
  4032. fn: function (aPoint) {
  4033. var self = this;
  4034. var $1;
  4035. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4036. return $1;
  4037. },
  4038. args: ["aPoint"],
  4039. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4040. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4041. referencedClasses: ["Point"]
  4042. }),
  4043. smalltalk.Point);
  4044. smalltalk.addMethod(
  4045. "__minus",
  4046. smalltalk.method({
  4047. selector: "-",
  4048. category: 'arithmetic',
  4049. fn: function (aPoint) {
  4050. var self = this;
  4051. var $1;
  4052. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4053. return $1;
  4054. },
  4055. args: ["aPoint"],
  4056. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4057. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4058. referencedClasses: ["Point"]
  4059. }),
  4060. smalltalk.Point);
  4061. smalltalk.addMethod(
  4062. "__slash",
  4063. smalltalk.method({
  4064. selector: "/",
  4065. category: 'arithmetic',
  4066. fn: function (aPoint) {
  4067. var self = this;
  4068. var $1;
  4069. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4070. return $1;
  4071. },
  4072. args: ["aPoint"],
  4073. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4074. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4075. referencedClasses: ["Point"]
  4076. }),
  4077. smalltalk.Point);
  4078. smalltalk.addMethod(
  4079. "__eq",
  4080. smalltalk.method({
  4081. selector: "=",
  4082. category: 'arithmetic',
  4083. fn: function (aPoint) {
  4084. var self = this;
  4085. var $1;
  4086. $1 = 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", [])])]);}]);
  4087. return $1;
  4088. },
  4089. args: ["aPoint"],
  4090. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  4091. messageSends: ["and:", "&", "=", "y", "x", "class"],
  4092. referencedClasses: []
  4093. }),
  4094. smalltalk.Point);
  4095. smalltalk.addMethod(
  4096. "_asPoint",
  4097. smalltalk.method({
  4098. selector: "asPoint",
  4099. category: 'converting',
  4100. fn: function () {
  4101. var self = this;
  4102. return self;
  4103. },
  4104. args: [],
  4105. source: "asPoint\x0a\x09^self",
  4106. messageSends: [],
  4107. referencedClasses: []
  4108. }),
  4109. smalltalk.Point);
  4110. smalltalk.addMethod(
  4111. "_printString",
  4112. smalltalk.method({
  4113. selector: "printString",
  4114. category: 'printing',
  4115. fn: function () {
  4116. var self = this;
  4117. var $2, $1;
  4118. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (stream) {smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@x'], "_printString", []), "__comma", ["@"])]);$2 = smalltalk.send(smalltalk.send(self['@y'], "_notNil", []), "_and_", [function () {return smalltalk.send(self['@y'], "_negative", []);}]);if (smalltalk.assert($2)) {smalltalk.send(stream, "_space", []);}return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self['@y'], "_printString", [])]);}]);
  4119. return $1;
  4120. },
  4121. args: [],
  4122. 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]",
  4123. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "ifTrue:", "space", "and:", "negative", "notNil"],
  4124. referencedClasses: ["String"]
  4125. }),
  4126. smalltalk.Point);
  4127. smalltalk.addMethod(
  4128. "_translateBy_",
  4129. smalltalk.method({
  4130. selector: "translateBy:",
  4131. category: 'transforming',
  4132. fn: function (delta) {
  4133. var self = this;
  4134. var $1;
  4135. $1 = smalltalk.send(smalltalk.send(smalltalk.send(delta, "_x", []), "__plus", [self['@x']]), "__at", [smalltalk.send(smalltalk.send(delta, "_y", []), "__plus", [self['@y']])]);
  4136. return $1;
  4137. },
  4138. args: ["delta"],
  4139. source: "translateBy: delta \x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  4140. messageSends: ["@", "+", "y", "x"],
  4141. referencedClasses: []
  4142. }),
  4143. smalltalk.Point);
  4144. smalltalk.addMethod(
  4145. "_x",
  4146. smalltalk.method({
  4147. selector: "x",
  4148. category: 'accessing',
  4149. fn: function () {
  4150. var self = this;
  4151. return self['@x'];
  4152. },
  4153. args: [],
  4154. source: "x\x0a\x09^x",
  4155. messageSends: [],
  4156. referencedClasses: []
  4157. }),
  4158. smalltalk.Point);
  4159. smalltalk.addMethod(
  4160. "_x_",
  4161. smalltalk.method({
  4162. selector: "x:",
  4163. category: 'accessing',
  4164. fn: function (aNumber) {
  4165. var self = this;
  4166. self['@x'] = aNumber;
  4167. return self;
  4168. },
  4169. args: ["aNumber"],
  4170. source: "x: aNumber\x0a\x09x := aNumber",
  4171. messageSends: [],
  4172. referencedClasses: []
  4173. }),
  4174. smalltalk.Point);
  4175. smalltalk.addMethod(
  4176. "_y",
  4177. smalltalk.method({
  4178. selector: "y",
  4179. category: 'accessing',
  4180. fn: function () {
  4181. var self = this;
  4182. return self['@y'];
  4183. },
  4184. args: [],
  4185. source: "y\x0a\x09^y",
  4186. messageSends: [],
  4187. referencedClasses: []
  4188. }),
  4189. smalltalk.Point);
  4190. smalltalk.addMethod(
  4191. "_y_",
  4192. smalltalk.method({
  4193. selector: "y:",
  4194. category: 'accessing',
  4195. fn: function (aNumber) {
  4196. var self = this;
  4197. self['@y'] = aNumber;
  4198. return self;
  4199. },
  4200. args: ["aNumber"],
  4201. source: "y: aNumber\x0a\x09y := aNumber",
  4202. messageSends: [],
  4203. referencedClasses: []
  4204. }),
  4205. smalltalk.Point);
  4206. smalltalk.addMethod(
  4207. "_x_y_",
  4208. smalltalk.method({
  4209. selector: "x:y:",
  4210. category: 'instance creation',
  4211. fn: function (aNumber, anotherNumber) {
  4212. var self = this;
  4213. var $2, $3, $1;
  4214. $2 = smalltalk.send(self, "_new", []);
  4215. smalltalk.send($2, "_x_", [aNumber]);
  4216. smalltalk.send($2, "_y_", [anotherNumber]);
  4217. $3 = smalltalk.send($2, "_yourself", []);
  4218. $1 = $3;
  4219. return $1;
  4220. },
  4221. args: ["aNumber", "anotherNumber"],
  4222. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4223. messageSends: ["x:", "new", "y:", "yourself"],
  4224. referencedClasses: []
  4225. }),
  4226. smalltalk.Point.klass);
  4227. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  4228. 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'`."
  4229. smalltalk.addMethod(
  4230. "_next",
  4231. smalltalk.method({
  4232. selector: "next",
  4233. category: 'accessing',
  4234. fn: function () {
  4235. var self = this;
  4236. return Math.random();
  4237. return self;
  4238. },
  4239. args: [],
  4240. source: "next\x0a\x09<return Math.random()>",
  4241. messageSends: [],
  4242. referencedClasses: []
  4243. }),
  4244. smalltalk.Random);
  4245. smalltalk.addMethod(
  4246. "_next_",
  4247. smalltalk.method({
  4248. selector: "next:",
  4249. category: 'accessing',
  4250. fn: function (anInteger) {
  4251. var self = this;
  4252. var $1;
  4253. $1 = smalltalk.send(smalltalk.send(1, "_to_", [anInteger]), "_collect_", [function (each) {return smalltalk.send(self, "_next", []);}]);
  4254. return $1;
  4255. },
  4256. args: ["anInteger"],
  4257. source: "next: anInteger\x0a ^(1 to: anInteger) collect: [:each | self next]",
  4258. messageSends: ["collect:", "next", "to:"],
  4259. referencedClasses: []
  4260. }),
  4261. smalltalk.Random);
  4262. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  4263. 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"
  4264. smalltalk.addMethod(
  4265. "_at_",
  4266. smalltalk.method({
  4267. selector: "at:",
  4268. category: 'accessing',
  4269. fn: function (aSymbol) {
  4270. var self = this;
  4271. return self[aSymbol._asString()];
  4272. return self;
  4273. },
  4274. args: ["aSymbol"],
  4275. source: "at: aSymbol\x0a\x09<return self[aSymbol._asString()]>",
  4276. messageSends: [],
  4277. referencedClasses: []
  4278. }),
  4279. smalltalk.Smalltalk);
  4280. smalltalk.addMethod(
  4281. "_basicParse_",
  4282. smalltalk.method({
  4283. selector: "basicParse:",
  4284. category: 'accessing',
  4285. fn: function (aString) {
  4286. var self = this;
  4287. return smalltalk.parser.parse(aString);
  4288. return self;
  4289. },
  4290. args: ["aString"],
  4291. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  4292. messageSends: [],
  4293. referencedClasses: []
  4294. }),
  4295. smalltalk.Smalltalk);
  4296. smalltalk.addMethod(
  4297. "_classes",
  4298. smalltalk.method({
  4299. selector: "classes",
  4300. category: 'classes',
  4301. fn: function () {
  4302. var self = this;
  4303. return self.classes();
  4304. return self;
  4305. },
  4306. args: [],
  4307. source: "classes\x0a\x09<return self.classes()>",
  4308. messageSends: [],
  4309. referencedClasses: []
  4310. }),
  4311. smalltalk.Smalltalk);
  4312. smalltalk.addMethod(
  4313. "_createPackage_",
  4314. smalltalk.method({
  4315. selector: "createPackage:",
  4316. category: 'private',
  4317. fn: function (packageName) {
  4318. var self = this;
  4319. return smalltalk.addPackage(packageName, nil);
  4320. return self;
  4321. },
  4322. args: ["packageName"],
  4323. 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)>",
  4324. messageSends: [],
  4325. referencedClasses: []
  4326. }),
  4327. smalltalk.Smalltalk);
  4328. smalltalk.addMethod(
  4329. "_createPackage_properties_",
  4330. smalltalk.method({
  4331. selector: "createPackage:properties:",
  4332. category: 'private',
  4333. fn: function (packageName, aDict) {
  4334. var self = this;
  4335. var object;
  4336. object = {};
  4337. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  4338. return smalltalk.addPackage(packageName, object);
  4339. return self;
  4340. },
  4341. args: ["packageName", "aDict"],
  4342. 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)>",
  4343. messageSends: ["keysAndValuesDo:"],
  4344. referencedClasses: []
  4345. }),
  4346. smalltalk.Smalltalk);
  4347. smalltalk.addMethod(
  4348. "_deleteClass_",
  4349. smalltalk.method({
  4350. selector: "deleteClass:",
  4351. category: 'private',
  4352. fn: function (aClass) {
  4353. var self = this;
  4354. self.removeClass(aClass);
  4355. return self;
  4356. },
  4357. args: ["aClass"],
  4358. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a \x0a\x09<self.removeClass(aClass)>",
  4359. messageSends: [],
  4360. referencedClasses: []
  4361. }),
  4362. smalltalk.Smalltalk);
  4363. smalltalk.addMethod(
  4364. "_deletePackage_",
  4365. smalltalk.method({
  4366. selector: "deletePackage:",
  4367. category: 'private',
  4368. fn: function (packageName) {
  4369. var self = this;
  4370. delete smalltalk.packages[packageName];
  4371. return self;
  4372. },
  4373. args: ["packageName"],
  4374. 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]>",
  4375. messageSends: [],
  4376. referencedClasses: []
  4377. }),
  4378. smalltalk.Smalltalk);
  4379. smalltalk.addMethod(
  4380. "_packageAt_",
  4381. smalltalk.method({
  4382. selector: "packageAt:",
  4383. category: 'packages',
  4384. fn: function (packageName) {
  4385. var self = this;
  4386. return self.packages[packageName];
  4387. return self;
  4388. },
  4389. args: ["packageName"],
  4390. source: "packageAt: packageName\x0a <return self.packages[packageName]>",
  4391. messageSends: [],
  4392. referencedClasses: []
  4393. }),
  4394. smalltalk.Smalltalk);
  4395. smalltalk.addMethod(
  4396. "_packageAt_ifAbsent_",
  4397. smalltalk.method({
  4398. selector: "packageAt:ifAbsent:",
  4399. category: 'packages',
  4400. fn: function (packageName, aBlock) {
  4401. var self = this;
  4402. var $2, $1;
  4403. $2 = smalltalk.send(self, "_packageAt_", [packageName]);
  4404. $1 = smalltalk.send($2, "_ifNil_", [aBlock]);
  4405. return $1;
  4406. },
  4407. args: ["packageName", "aBlock"],
  4408. source: "packageAt: packageName ifAbsent: aBlock\x0a ^(self packageAt: packageName) ifNil: aBlock",
  4409. messageSends: ["ifNil:", "packageAt:"],
  4410. referencedClasses: []
  4411. }),
  4412. smalltalk.Smalltalk);
  4413. smalltalk.addMethod(
  4414. "_packages",
  4415. smalltalk.method({
  4416. selector: "packages",
  4417. category: 'packages',
  4418. fn: function () {
  4419. var self = this;
  4420. return self.packages.all();
  4421. return self;
  4422. },
  4423. args: [],
  4424. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  4425. messageSends: [],
  4426. referencedClasses: []
  4427. }),
  4428. smalltalk.Smalltalk);
  4429. smalltalk.addMethod(
  4430. "_parse_",
  4431. smalltalk.method({
  4432. selector: "parse:",
  4433. category: 'accessing',
  4434. fn: function (aString) {
  4435. var self = this;
  4436. var result;
  4437. smalltalk.send(self, "_try_catch_", [function () {result = smalltalk.send(self, "_basicParse_", [aString]);return result;}, function (ex) {return smalltalk.send(smalltalk.send(self, "_parseError_parsing_", [ex, aString]), "_signal", []);}]);
  4438. return result;
  4439. },
  4440. args: ["aString"],
  4441. source: "parse: aString\x0a\x09| result | \x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  4442. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  4443. referencedClasses: []
  4444. }),
  4445. smalltalk.Smalltalk);
  4446. smalltalk.addMethod(
  4447. "_parseError_parsing_",
  4448. smalltalk.method({
  4449. selector: "parseError:parsing:",
  4450. category: 'accessing',
  4451. fn: function (anException, aString) {
  4452. var self = this;
  4453. var $1;
  4454. var row;
  4455. var col;
  4456. var message;
  4457. var lines;
  4458. var badLine;
  4459. var code;
  4460. row = anException.line;
  4461. col = anException.column;
  4462. message = anException.message;
  4463. lines = smalltalk.send(aString, "_lines", []);
  4464. badLine = smalltalk.send(lines, "_at_", [row]);
  4465. badLine = smalltalk.send(smalltalk.send(smalltalk.send(badLine, "_copyFrom_to_", [1, smalltalk.send(col, "__minus", [1])]), "__comma", [" ===>"]), "__comma", [smalltalk.send(badLine, "_copyFrom_to_", [col, smalltalk.send(badLine, "_size", [])])]);
  4466. smalltalk.send(lines, "_at_put_", [row, badLine]);
  4467. 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", [])])]);}]);}]);
  4468. $1 = smalltalk.send(smalltalk.send(smalltalk.ParseError || ParseError, "_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])]);
  4469. return $1;
  4470. },
  4471. args: ["anException", "aString"],
  4472. 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^ ParseError new messageText: ('Parse error on line ' , row , ' column ' , col , ' : ' , message , ' Below is code with line numbers and ===> marker inserted:' , String lf, code)",
  4473. messageSends: ["lines", "at:", ",", "copyFrom:to:", "size", "-", "at:put:", "streamContents:", "withIndexDo:", "nextPutAll:", "lf", "asString", "messageText:", "new"],
  4474. referencedClasses: ["String", "ParseError"]
  4475. }),
  4476. smalltalk.Smalltalk);
  4477. smalltalk.addMethod(
  4478. "_pseudoVariableNames",
  4479. smalltalk.method({
  4480. selector: "pseudoVariableNames",
  4481. category: 'packages',
  4482. fn: function () {
  4483. var self = this;
  4484. return ["self", "super", "nil", "true", "false", "thisContext"];
  4485. },
  4486. args: [],
  4487. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  4488. messageSends: [],
  4489. referencedClasses: []
  4490. }),
  4491. smalltalk.Smalltalk);
  4492. smalltalk.addMethod(
  4493. "_readJSObject_",
  4494. smalltalk.method({
  4495. selector: "readJSObject:",
  4496. category: 'accessing',
  4497. fn: function (anObject) {
  4498. var self = this;
  4499. return self.readJSObject(anObject);
  4500. return self;
  4501. },
  4502. args: ["anObject"],
  4503. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  4504. messageSends: [],
  4505. referencedClasses: []
  4506. }),
  4507. smalltalk.Smalltalk);
  4508. smalltalk.addMethod(
  4509. "_removeClass_",
  4510. smalltalk.method({
  4511. selector: "removeClass:",
  4512. category: 'classes',
  4513. fn: function (aClass) {
  4514. var self = this;
  4515. var $1, $2, $3;
  4516. $1 = smalltalk.send(aClass, "_isMetaclass", []);
  4517. if (smalltalk.assert($1)) {
  4518. smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);
  4519. }
  4520. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);}]);
  4521. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);}]);
  4522. smalltalk.send(self, "_deleteClass_", [aClass]);
  4523. $2 = smalltalk.send(smalltalk.ClassRemoved || ClassRemoved, "_new", []);
  4524. smalltalk.send($2, "_theClass_", [aClass]);
  4525. $3 = smalltalk.send($2, "_yourself", []);
  4526. smalltalk.send(smalltalk.send(smalltalk.SystemAnnouncer || SystemAnnouncer, "_current", []), "_announce_", [$3]);
  4527. return self;
  4528. },
  4529. args: ["aClass"],
  4530. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a \x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09aClass removeCompiledMethod: each].\x0a \x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09aClass class removeCompiledMethod: each].\x0a \x0a\x09self deleteClass: aClass.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassRemoved new\x0a \x09theClass: aClass;\x0a yourself)",
  4531. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "do:", "removeCompiledMethod:", "values", "methodDictionary", "class", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  4532. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  4533. }),
  4534. smalltalk.Smalltalk);
  4535. smalltalk.addMethod(
  4536. "_removePackage_",
  4537. smalltalk.method({
  4538. selector: "removePackage:",
  4539. category: 'packages',
  4540. fn: function (packageName) {
  4541. var self = this;
  4542. var pkg;
  4543. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4544. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [function (each) {return smalltalk.send(self, "_removeClass_", [each]);}]);
  4545. smalltalk.send(self, "_deletePackage_", [packageName]);
  4546. return self;
  4547. },
  4548. args: ["packageName"],
  4549. 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",
  4550. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  4551. referencedClasses: []
  4552. }),
  4553. smalltalk.Smalltalk);
  4554. smalltalk.addMethod(
  4555. "_renamePackage_to_",
  4556. smalltalk.method({
  4557. selector: "renamePackage:to:",
  4558. category: 'packages',
  4559. fn: function (packageName, newName) {
  4560. var self = this;
  4561. var $1;
  4562. var pkg;
  4563. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4564. $1 = smalltalk.send(self, "_packageAt_", [newName]);
  4565. if (($receiver = $1) == nil || $receiver == undefined) {
  4566. } else {
  4567. smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);
  4568. }
  4569. smalltalk.packages[newName] = smalltalk.packages[packageName];
  4570. smalltalk.send(pkg, "_name_", [newName]);
  4571. smalltalk.send(self, "_deletePackage_", [packageName]);
  4572. return self;
  4573. },
  4574. args: ["packageName", "newName"],
  4575. 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.",
  4576. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "deletePackage:"],
  4577. referencedClasses: []
  4578. }),
  4579. smalltalk.Smalltalk);
  4580. smalltalk.addMethod(
  4581. "_reservedWords",
  4582. smalltalk.method({
  4583. selector: "reservedWords",
  4584. category: 'accessing',
  4585. fn: function () {
  4586. var self = this;
  4587. return self.reservedWords;
  4588. return self;
  4589. },
  4590. args: [],
  4591. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  4592. messageSends: [],
  4593. referencedClasses: []
  4594. }),
  4595. smalltalk.Smalltalk);
  4596. smalltalk.addMethod(
  4597. "_send_to_arguments_",
  4598. smalltalk.method({
  4599. selector: "send:to:arguments:",
  4600. category: 'accessing',
  4601. fn: function (aSelector, anObject, aCollection) {
  4602. var self = this;
  4603. var selector;
  4604. selector = smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []);
  4605. return self.send(anObject, selector, aCollection);
  4606. return self;
  4607. },
  4608. args: ["aSelector", "anObject", "aCollection"],
  4609. source: "send: aSelector to: anObject arguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSelector asString asSelector.\x0a\x09<return self.send(anObject, selector, aCollection)>",
  4610. messageSends: ["asSelector", "asString"],
  4611. referencedClasses: []
  4612. }),
  4613. smalltalk.Smalltalk);
  4614. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  4615. smalltalk.addMethod(
  4616. "_current",
  4617. smalltalk.method({
  4618. selector: "current",
  4619. category: 'accessing',
  4620. fn: function () {
  4621. var self = this;
  4622. return smalltalk;
  4623. return self;
  4624. },
  4625. args: [],
  4626. source: "current\x0a\x09<return smalltalk>",
  4627. messageSends: [],
  4628. referencedClasses: []
  4629. }),
  4630. smalltalk.Smalltalk.klass);
  4631. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  4632. 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."
  4633. smalltalk.addMethod(
  4634. "_asJSON",
  4635. smalltalk.method({
  4636. selector: "asJSON",
  4637. category: 'converting',
  4638. fn: function () {
  4639. var self = this;
  4640. return null;
  4641. },
  4642. args: [],
  4643. source: "asJSON\x0a\x09^null",
  4644. messageSends: [],
  4645. referencedClasses: []
  4646. }),
  4647. smalltalk.UndefinedObject);
  4648. smalltalk.addMethod(
  4649. "_deepCopy",
  4650. smalltalk.method({
  4651. selector: "deepCopy",
  4652. category: 'copying',
  4653. fn: function () {
  4654. var self = this;
  4655. return self;
  4656. },
  4657. args: [],
  4658. source: "deepCopy\x0a\x09^self",
  4659. messageSends: [],
  4660. referencedClasses: []
  4661. }),
  4662. smalltalk.UndefinedObject);
  4663. smalltalk.addMethod(
  4664. "_ifNil_",
  4665. smalltalk.method({
  4666. selector: "ifNil:",
  4667. category: 'testing',
  4668. fn: function (aBlock) {
  4669. var self = this;
  4670. var $1;
  4671. $1 = smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, function () {}]);
  4672. return $1;
  4673. },
  4674. args: ["aBlock"],
  4675. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  4676. messageSends: ["ifNil:ifNotNil:"],
  4677. referencedClasses: []
  4678. }),
  4679. smalltalk.UndefinedObject);
  4680. smalltalk.addMethod(
  4681. "_ifNil_ifNotNil_",
  4682. smalltalk.method({
  4683. selector: "ifNil:ifNotNil:",
  4684. category: 'testing',
  4685. fn: function (aBlock, anotherBlock) {
  4686. var self = this;
  4687. var $1;
  4688. $1 = smalltalk.send(aBlock, "_value", []);
  4689. return $1;
  4690. },
  4691. args: ["aBlock", "anotherBlock"],
  4692. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  4693. messageSends: ["value"],
  4694. referencedClasses: []
  4695. }),
  4696. smalltalk.UndefinedObject);
  4697. smalltalk.addMethod(
  4698. "_ifNotNil_",
  4699. smalltalk.method({
  4700. selector: "ifNotNil:",
  4701. category: 'testing',
  4702. fn: function (aBlock) {
  4703. var self = this;
  4704. return self;
  4705. },
  4706. args: ["aBlock"],
  4707. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  4708. messageSends: [],
  4709. referencedClasses: []
  4710. }),
  4711. smalltalk.UndefinedObject);
  4712. smalltalk.addMethod(
  4713. "_ifNotNil_ifNil_",
  4714. smalltalk.method({
  4715. selector: "ifNotNil:ifNil:",
  4716. category: 'testing',
  4717. fn: function (aBlock, anotherBlock) {
  4718. var self = this;
  4719. var $1;
  4720. $1 = smalltalk.send(anotherBlock, "_value", []);
  4721. return $1;
  4722. },
  4723. args: ["aBlock", "anotherBlock"],
  4724. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  4725. messageSends: ["value"],
  4726. referencedClasses: []
  4727. }),
  4728. smalltalk.UndefinedObject);
  4729. smalltalk.addMethod(
  4730. "_isNil",
  4731. smalltalk.method({
  4732. selector: "isNil",
  4733. category: 'testing',
  4734. fn: function () {
  4735. var self = this;
  4736. return true;
  4737. },
  4738. args: [],
  4739. source: "isNil\x0a\x09^true",
  4740. messageSends: [],
  4741. referencedClasses: []
  4742. }),
  4743. smalltalk.UndefinedObject);
  4744. smalltalk.addMethod(
  4745. "_notNil",
  4746. smalltalk.method({
  4747. selector: "notNil",
  4748. category: 'testing',
  4749. fn: function () {
  4750. var self = this;
  4751. return false;
  4752. },
  4753. args: [],
  4754. source: "notNil\x0a\x09^false",
  4755. messageSends: [],
  4756. referencedClasses: []
  4757. }),
  4758. smalltalk.UndefinedObject);
  4759. smalltalk.addMethod(
  4760. "_printString",
  4761. smalltalk.method({
  4762. selector: "printString",
  4763. category: 'printing',
  4764. fn: function () {
  4765. var self = this;
  4766. return "nil";
  4767. },
  4768. args: [],
  4769. source: "printString\x0a ^'nil'",
  4770. messageSends: [],
  4771. referencedClasses: []
  4772. }),
  4773. smalltalk.UndefinedObject);
  4774. smalltalk.addMethod(
  4775. "_shallowCopy",
  4776. smalltalk.method({
  4777. selector: "shallowCopy",
  4778. category: 'copying',
  4779. fn: function () {
  4780. var self = this;
  4781. return self;
  4782. },
  4783. args: [],
  4784. source: "shallowCopy\x0a\x09^self",
  4785. messageSends: [],
  4786. referencedClasses: []
  4787. }),
  4788. smalltalk.UndefinedObject);
  4789. smalltalk.addMethod(
  4790. "_subclass_instanceVariableNames_",
  4791. smalltalk.method({
  4792. selector: "subclass:instanceVariableNames:",
  4793. category: 'class creation',
  4794. fn: function (aString, anotherString) {
  4795. var self = this;
  4796. var $1;
  4797. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  4798. return $1;
  4799. },
  4800. args: ["aString", "anotherString"],
  4801. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4802. messageSends: ["subclass:instanceVariableNames:package:"],
  4803. referencedClasses: []
  4804. }),
  4805. smalltalk.UndefinedObject);
  4806. smalltalk.addMethod(
  4807. "_subclass_instanceVariableNames_category_",
  4808. smalltalk.method({
  4809. selector: "subclass:instanceVariableNames:category:",
  4810. category: 'class creation',
  4811. fn: function (aString, aString2, aString3) {
  4812. var self = this;
  4813. var $1;
  4814. smalltalk.send(self, "_deprecatedAPI", []);
  4815. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  4816. return $1;
  4817. },
  4818. args: ["aString", "aString2", "aString3"],
  4819. 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",
  4820. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4821. referencedClasses: []
  4822. }),
  4823. smalltalk.UndefinedObject);
  4824. smalltalk.addMethod(
  4825. "_subclass_instanceVariableNames_package_",
  4826. smalltalk.method({
  4827. selector: "subclass:instanceVariableNames:package:",
  4828. category: 'class creation',
  4829. fn: function (aString, aString2, aString3) {
  4830. var self = this;
  4831. var $1;
  4832. $1 = smalltalk.send(smalltalk.send(smalltalk.ClassBuilder || ClassBuilder, "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
  4833. return $1;
  4834. },
  4835. args: ["aString", "aString2", "aString3"],
  4836. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString instanceVariableNames: aString2 package: aString3",
  4837. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new"],
  4838. referencedClasses: ["ClassBuilder"]
  4839. }),
  4840. smalltalk.UndefinedObject);
  4841. smalltalk.addMethod(
  4842. "_new",
  4843. smalltalk.method({
  4844. selector: "new",
  4845. category: 'instance creation',
  4846. fn: function () {
  4847. var self = this;
  4848. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  4849. return self;
  4850. },
  4851. args: [],
  4852. source: "new\x0a\x09 self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4853. messageSends: ["error:"],
  4854. referencedClasses: []
  4855. }),
  4856. smalltalk.UndefinedObject.klass);
  4857. smalltalk.addPackage('Kernel-Classes', {});
  4858. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  4859. 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."
  4860. smalltalk.addMethod(
  4861. "_addCompiledMethod_",
  4862. smalltalk.method({
  4863. selector: "addCompiledMethod:",
  4864. category: 'compiling',
  4865. fn: function (aMethod){
  4866. var self=this;
  4867. var $1,$2;
  4868. smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
  4869. ;
  4870. $1=smalltalk.send((smalltalk.MethodAdded || MethodAdded),"_new",[]);
  4871. smalltalk.send($1,"_theClass_",[self]);
  4872. smalltalk.send($1,"_method_",[aMethod]);
  4873. $2=smalltalk.send($1,"_yourself",[]);
  4874. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  4875. return self},
  4876. args: ["aMethod"],
  4877. source: "addCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodAdded new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  4878. messageSends: ["announce:", "theClass:", "new", "method:", "yourself", "current"],
  4879. referencedClasses: ["MethodAdded", "SystemAnnouncer"]
  4880. }),
  4881. smalltalk.Behavior);
  4882. smalltalk.addMethod(
  4883. "_allInstanceVariableNames",
  4884. smalltalk.method({
  4885. selector: "allInstanceVariableNames",
  4886. category: 'accessing',
  4887. fn: function (){
  4888. var self=this;
  4889. var $1;
  4890. var result;
  4891. result=smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_copy",[]);
  4892. $1=smalltalk.send(self,"_superclass",[]);
  4893. if(($receiver = $1) == nil || $receiver == undefined){
  4894. $1;
  4895. } else {
  4896. smalltalk.send(result,"_addAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_allInstanceVariableNames",[])]);
  4897. };
  4898. return result;
  4899. },
  4900. args: [],
  4901. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09 result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  4902. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  4903. referencedClasses: []
  4904. }),
  4905. smalltalk.Behavior);
  4906. smalltalk.addMethod(
  4907. "_allSubclasses",
  4908. smalltalk.method({
  4909. selector: "allSubclasses",
  4910. category: 'accessing',
  4911. fn: function (){
  4912. var self=this;
  4913. var result;
  4914. result=smalltalk.send(self,"_subclasses",[]);
  4915. smalltalk.send(smalltalk.send(self,"_subclasses",[]),"_do_",[(function(each){
  4916. return smalltalk.send(result,"_addAll_",[smalltalk.send(each,"_allSubclasses",[])]);
  4917. })]);
  4918. return result;
  4919. },
  4920. args: [],
  4921. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09 result addAll: each allSubclasses].\x0a\x09^result",
  4922. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  4923. referencedClasses: []
  4924. }),
  4925. smalltalk.Behavior);
  4926. smalltalk.addMethod(
  4927. "_allSuperclasses",
  4928. smalltalk.method({
  4929. selector: "allSuperclasses",
  4930. category: 'accessing',
  4931. fn: function (){
  4932. var self=this;
  4933. var $1,$3,$4,$2;
  4934. $1=smalltalk.send(self,"_superclass",[]);
  4935. if(($receiver = $1) == nil || $receiver == undefined){
  4936. return [];
  4937. } else {
  4938. $1;
  4939. };
  4940. $3=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_with_",[smalltalk.send(self,"_superclass",[])]);
  4941. smalltalk.send($3,"_addAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_allSuperclasses",[])]);
  4942. $4=smalltalk.send($3,"_yourself",[]);
  4943. $2=$4;
  4944. return $2;
  4945. },
  4946. args: [],
  4947. source: "allSuperclasses\x0a\x09\x0a self superclass ifNil: [ ^ #() ].\x0a \x0a\x09^ (OrderedCollection with: self superclass) \x0a \x09addAll: self superclass allSuperclasses;\x0a yourself",
  4948. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  4949. referencedClasses: ["OrderedCollection"]
  4950. }),
  4951. smalltalk.Behavior);
  4952. smalltalk.addMethod(
  4953. "_basicNew",
  4954. smalltalk.method({
  4955. selector: "basicNew",
  4956. category: 'instance creation',
  4957. fn: function (){
  4958. var self=this;
  4959. return new self.fn();
  4960. ;
  4961. return self},
  4962. args: [],
  4963. source: "basicNew\x0a\x09<return new self.fn()>",
  4964. messageSends: [],
  4965. referencedClasses: []
  4966. }),
  4967. smalltalk.Behavior);
  4968. smalltalk.addMethod(
  4969. "_canUnderstand_",
  4970. smalltalk.method({
  4971. selector: "canUnderstand:",
  4972. category: 'testing',
  4973. fn: function (aSelector){
  4974. var self=this;
  4975. var $1;
  4976. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_keys",[]),"_includes_",[smalltalk.send(aSelector,"_asString",[])]),"_or_",[(function(){
  4977. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_superclass",[]),"_notNil",[]),"_and_",[(function(){
  4978. return smalltalk.send(smalltalk.send(self,"_superclass",[]),"_canUnderstand_",[aSelector]);
  4979. })]);
  4980. })]);
  4981. return $1;
  4982. },
  4983. args: ["aSelector"],
  4984. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  4985. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  4986. referencedClasses: []
  4987. }),
  4988. smalltalk.Behavior);
  4989. smalltalk.addMethod(
  4990. "_comment",
  4991. smalltalk.method({
  4992. selector: "comment",
  4993. category: 'accessing',
  4994. fn: function (){
  4995. var self=this;
  4996. var $2,$1;
  4997. $2=smalltalk.send(self,"_basicAt_",["comment"]);
  4998. if(($receiver = $2) == nil || $receiver == undefined){
  4999. $1="";
  5000. } else {
  5001. $1=$2;
  5002. };
  5003. return $1;
  5004. },
  5005. args: [],
  5006. source: "comment\x0a ^(self basicAt: 'comment') ifNil: ['']",
  5007. messageSends: ["ifNil:", "basicAt:"],
  5008. referencedClasses: []
  5009. }),
  5010. smalltalk.Behavior);
  5011. smalltalk.addMethod(
  5012. "_comment_",
  5013. smalltalk.method({
  5014. selector: "comment:",
  5015. category: 'accessing',
  5016. fn: function (aString){
  5017. var self=this;
  5018. var $1,$2;
  5019. smalltalk.send(self,"_basicAt_put_",["comment",aString]);
  5020. $1=smalltalk.send((smalltalk.ClassCommentChanged || ClassCommentChanged),"_new",[]);
  5021. smalltalk.send($1,"_theClass_",[self]);
  5022. $2=smalltalk.send($1,"_yourself",[]);
  5023. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5024. return self},
  5025. args: ["aString"],
  5026. source: "comment: aString\x0a self basicAt: 'comment' put: aString.\x0a SystemAnnouncer current\x0a \x09announce: (ClassCommentChanged new\x0a \x09theClass: self;\x0a yourself)",
  5027. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  5028. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  5029. }),
  5030. smalltalk.Behavior);
  5031. smalltalk.addMethod(
  5032. "_commentStamp",
  5033. smalltalk.method({
  5034. selector: "commentStamp",
  5035. category: 'accessing',
  5036. fn: function (){
  5037. var self=this;
  5038. var $2,$3,$1;
  5039. $2=smalltalk.send((smalltalk.ClassCommentReader || ClassCommentReader),"_new",[]);
  5040. smalltalk.send($2,"_class_",[self]);
  5041. $3=smalltalk.send($2,"_yourself",[]);
  5042. $1=$3;
  5043. return $1;
  5044. },
  5045. args: [],
  5046. source: "commentStamp\x0a ^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  5047. messageSends: ["class:", "new", "yourself"],
  5048. referencedClasses: ["ClassCommentReader"]
  5049. }),
  5050. smalltalk.Behavior);
  5051. smalltalk.addMethod(
  5052. "_commentStamp_prior_",
  5053. smalltalk.method({
  5054. selector: "commentStamp:prior:",
  5055. category: 'accessing',
  5056. fn: function (aStamp,prior){
  5057. var self=this;
  5058. var $1;
  5059. $1=smalltalk.send(self,"_commentStamp",[]);
  5060. return $1;
  5061. },
  5062. args: ["aStamp", "prior"],
  5063. source: "commentStamp: aStamp prior: prior\x0a ^self commentStamp",
  5064. messageSends: ["commentStamp"],
  5065. referencedClasses: []
  5066. }),
  5067. smalltalk.Behavior);
  5068. smalltalk.addMethod(
  5069. "_compile_",
  5070. smalltalk.method({
  5071. selector: "compile:",
  5072. category: 'compiling',
  5073. fn: function (aString){
  5074. var self=this;
  5075. smalltalk.send(self,"_compile_category_",[aString,""]);
  5076. return self},
  5077. args: ["aString"],
  5078. source: "compile: aString\x0a\x09self compile: aString category: ''",
  5079. messageSends: ["compile:category:"],
  5080. referencedClasses: []
  5081. }),
  5082. smalltalk.Behavior);
  5083. smalltalk.addMethod(
  5084. "_compile_category_",
  5085. smalltalk.method({
  5086. selector: "compile:category:",
  5087. category: 'compiling',
  5088. fn: function (aString,anotherString){
  5089. var self=this;
  5090. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[aString,self,anotherString]);
  5091. return self},
  5092. args: ["aString", "anotherString"],
  5093. source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString \x0a forClass: self \x0a category: anotherString",
  5094. messageSends: ["install:forClass:category:", "new"],
  5095. referencedClasses: ["Compiler"]
  5096. }),
  5097. smalltalk.Behavior);
  5098. smalltalk.addMethod(
  5099. "_definition",
  5100. smalltalk.method({
  5101. selector: "definition",
  5102. category: 'accessing',
  5103. fn: function (){
  5104. var self=this;
  5105. return "";
  5106. },
  5107. args: [],
  5108. source: "definition\x0a\x09^ ''",
  5109. messageSends: [],
  5110. referencedClasses: []
  5111. }),
  5112. smalltalk.Behavior);
  5113. smalltalk.addMethod(
  5114. "_inheritsFrom_",
  5115. smalltalk.method({
  5116. selector: "inheritsFrom:",
  5117. category: 'testing',
  5118. fn: function (aClass){
  5119. var self=this;
  5120. var $1;
  5121. $1=smalltalk.send(smalltalk.send(aClass,"_allSubclasses",[]),"_includes_",[self]);
  5122. return $1;
  5123. },
  5124. args: ["aClass"],
  5125. source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
  5126. messageSends: ["includes:", "allSubclasses"],
  5127. referencedClasses: []
  5128. }),
  5129. smalltalk.Behavior);
  5130. smalltalk.addMethod(
  5131. "_instanceVariableNames",
  5132. smalltalk.method({
  5133. selector: "instanceVariableNames",
  5134. category: 'accessing',
  5135. fn: function (){
  5136. var self=this;
  5137. return self.iVarNames;
  5138. ;
  5139. return self},
  5140. args: [],
  5141. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5142. messageSends: [],
  5143. referencedClasses: []
  5144. }),
  5145. smalltalk.Behavior);
  5146. smalltalk.addMethod(
  5147. "_methodAt_",
  5148. smalltalk.method({
  5149. selector: "methodAt:",
  5150. category: 'accessing',
  5151. fn: function (aSymbol){
  5152. var self=this;
  5153. return smalltalk.methods(self)[aSymbol._asString()];
  5154. ;
  5155. return self},
  5156. args: ["aSymbol"],
  5157. source: "methodAt: aSymbol\x0a\x09<return smalltalk.methods(self)[aSymbol._asString()]>",
  5158. messageSends: [],
  5159. referencedClasses: []
  5160. }),
  5161. smalltalk.Behavior);
  5162. smalltalk.addMethod(
  5163. "_methodDictionary",
  5164. smalltalk.method({
  5165. selector: "methodDictionary",
  5166. category: 'accessing',
  5167. fn: function (){
  5168. var self=this;
  5169. var dict = smalltalk.HashedCollection._new();
  5170. var methods = self.fn.prototype.methods;
  5171. for(var i in methods) {
  5172. if(methods[i].selector) {
  5173. dict._at_put_(methods[i].selector, methods[i]);
  5174. }
  5175. };
  5176. return dict;
  5177. ;
  5178. return self},
  5179. args: [],
  5180. 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>",
  5181. messageSends: [],
  5182. referencedClasses: []
  5183. }),
  5184. smalltalk.Behavior);
  5185. smalltalk.addMethod(
  5186. "_methods",
  5187. smalltalk.method({
  5188. selector: "methods",
  5189. category: 'accessing',
  5190. fn: function (){
  5191. var self=this;
  5192. var $1;
  5193. $1=smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]);
  5194. return $1;
  5195. },
  5196. args: [],
  5197. source: "methods\x0a\x09^ self methodDictionary values",
  5198. messageSends: ["values", "methodDictionary"],
  5199. referencedClasses: []
  5200. }),
  5201. smalltalk.Behavior);
  5202. smalltalk.addMethod(
  5203. "_methodsFor_",
  5204. smalltalk.method({
  5205. selector: "methodsFor:",
  5206. category: 'accessing',
  5207. fn: function (aString){
  5208. var self=this;
  5209. var $2,$3,$1;
  5210. $2=smalltalk.send((smalltalk.ClassCategoryReader || ClassCategoryReader),"_new",[]);
  5211. smalltalk.send($2,"_class_category_",[self,aString]);
  5212. $3=smalltalk.send($2,"_yourself",[]);
  5213. $1=$3;
  5214. return $1;
  5215. },
  5216. args: ["aString"],
  5217. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09 class: self category: aString;\x0a\x09 yourself",
  5218. messageSends: ["class:category:", "new", "yourself"],
  5219. referencedClasses: ["ClassCategoryReader"]
  5220. }),
  5221. smalltalk.Behavior);
  5222. smalltalk.addMethod(
  5223. "_methodsFor_stamp_",
  5224. smalltalk.method({
  5225. selector: "methodsFor:stamp:",
  5226. category: 'accessing',
  5227. fn: function (aString,aStamp){
  5228. var self=this;
  5229. var $1;
  5230. $1=smalltalk.send(self,"_methodsFor_",[aString]);
  5231. return $1;
  5232. },
  5233. args: ["aString", "aStamp"],
  5234. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  5235. messageSends: ["methodsFor:"],
  5236. referencedClasses: []
  5237. }),
  5238. smalltalk.Behavior);
  5239. smalltalk.addMethod(
  5240. "_methodsInProtocol_",
  5241. smalltalk.method({
  5242. selector: "methodsInProtocol:",
  5243. category: 'accessing',
  5244. fn: function (aString){
  5245. var self=this;
  5246. var $1;
  5247. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]),"_select_",[(function(each){
  5248. return smalltalk.send(smalltalk.send(each,"_protocol",[]),"__eq",[aString]);
  5249. })]);
  5250. return $1;
  5251. },
  5252. args: ["aString"],
  5253. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  5254. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  5255. referencedClasses: []
  5256. }),
  5257. smalltalk.Behavior);
  5258. smalltalk.addMethod(
  5259. "_name",
  5260. smalltalk.method({
  5261. selector: "name",
  5262. category: 'accessing',
  5263. fn: function (){
  5264. var self=this;
  5265. return self.className || nil;
  5266. ;
  5267. return self},
  5268. args: [],
  5269. source: "name\x0a\x09<return self.className || nil>",
  5270. messageSends: [],
  5271. referencedClasses: []
  5272. }),
  5273. smalltalk.Behavior);
  5274. smalltalk.addMethod(
  5275. "_new",
  5276. smalltalk.method({
  5277. selector: "new",
  5278. category: 'instance creation',
  5279. fn: function (){
  5280. var self=this;
  5281. var $1;
  5282. $1=smalltalk.send(smalltalk.send(self,"_basicNew",[]),"_initialize",[]);
  5283. return $1;
  5284. },
  5285. args: [],
  5286. source: "new\x0a\x09^self basicNew initialize",
  5287. messageSends: ["initialize", "basicNew"],
  5288. referencedClasses: []
  5289. }),
  5290. smalltalk.Behavior);
  5291. smalltalk.addMethod(
  5292. "_organization",
  5293. smalltalk.method({
  5294. selector: "organization",
  5295. category: 'accessing',
  5296. fn: function (){
  5297. var self=this;
  5298. var $1;
  5299. $1=smalltalk.send(self,"_basicAt_",["organization"]);
  5300. return $1;
  5301. },
  5302. args: [],
  5303. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5304. messageSends: ["basicAt:"],
  5305. referencedClasses: []
  5306. }),
  5307. smalltalk.Behavior);
  5308. smalltalk.addMethod(
  5309. "_protocols",
  5310. smalltalk.method({
  5311. selector: "protocols",
  5312. category: 'accessing',
  5313. fn: function (){
  5314. var self=this;
  5315. var $1;
  5316. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_organization",[]),"_elements",[]),"_sorted",[]);
  5317. return $1;
  5318. },
  5319. args: [],
  5320. source: "protocols\x0a ^ self organization elements sorted",
  5321. messageSends: ["sorted", "elements", "organization"],
  5322. referencedClasses: []
  5323. }),
  5324. smalltalk.Behavior);
  5325. smalltalk.addMethod(
  5326. "_protocolsDo_",
  5327. smalltalk.method({
  5328. selector: "protocolsDo:",
  5329. category: 'accessing',
  5330. fn: function (aBlock){
  5331. var self=this;
  5332. var methodsByCategory;
  5333. methodsByCategory=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_new",[]);
  5334. smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]),"_do_",[(function(m){
  5335. return smalltalk.send(smalltalk.send(methodsByCategory,"_at_ifAbsentPut_",[smalltalk.send(m,"_category",[]),(function(){
  5336. return smalltalk.send((smalltalk.Array || Array),"_new",[]);
  5337. })]),"_add_",[m]);
  5338. })]);
  5339. smalltalk.send(smalltalk.send(self,"_protocols",[]),"_do_",[(function(category){
  5340. return smalltalk.send(aBlock,"_value_value_",[category,smalltalk.send(methodsByCategory,"_at_",[category])]);
  5341. })]);
  5342. return self},
  5343. args: ["aBlock"],
  5344. 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)]",
  5345. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  5346. referencedClasses: ["HashedCollection", "Array"]
  5347. }),
  5348. smalltalk.Behavior);
  5349. smalltalk.addMethod(
  5350. "_prototype",
  5351. smalltalk.method({
  5352. selector: "prototype",
  5353. category: 'accessing',
  5354. fn: function (){
  5355. var self=this;
  5356. return self.fn.prototype;
  5357. ;
  5358. return self},
  5359. args: [],
  5360. source: "prototype\x0a\x09<return self.fn.prototype>",
  5361. messageSends: [],
  5362. referencedClasses: []
  5363. }),
  5364. smalltalk.Behavior);
  5365. smalltalk.addMethod(
  5366. "_removeCompiledMethod_",
  5367. smalltalk.method({
  5368. selector: "removeCompiledMethod:",
  5369. category: 'compiling',
  5370. fn: function (aMethod){
  5371. var self=this;
  5372. var $1,$2;
  5373. smalltalk.removeMethod(aMethod)
  5374. smalltalk.init(self);
  5375. ;
  5376. ;
  5377. $1=smalltalk.send((smalltalk.MethodRemoved || MethodRemoved),"_new",[]);
  5378. smalltalk.send($1,"_theClass_",[self]);
  5379. smalltalk.send($1,"_method_",[aMethod]);
  5380. $2=smalltalk.send($1,"_yourself",[]);
  5381. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5382. return self},
  5383. args: ["aMethod"],
  5384. source: "removeCompiledMethod: aMethod\x0a\x09<\x0a \x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a >.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodRemoved new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  5385. messageSends: ["announce:", "theClass:", "new", "method:", "yourself", "current"],
  5386. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  5387. }),
  5388. smalltalk.Behavior);
  5389. smalltalk.addMethod(
  5390. "_selectors",
  5391. smalltalk.method({
  5392. selector: "selectors",
  5393. category: 'accessing',
  5394. fn: function (){
  5395. var self=this;
  5396. var $1;
  5397. $1=smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_keys",[]);
  5398. return $1;
  5399. },
  5400. args: [],
  5401. source: "selectors\x0a\x09^ self methodDictionary keys",
  5402. messageSends: ["keys", "methodDictionary"],
  5403. referencedClasses: []
  5404. }),
  5405. smalltalk.Behavior);
  5406. smalltalk.addMethod(
  5407. "_subclasses",
  5408. smalltalk.method({
  5409. selector: "subclasses",
  5410. category: 'accessing',
  5411. fn: function (){
  5412. var self=this;
  5413. return smalltalk.subclasses(self);
  5414. ;
  5415. return self},
  5416. args: [],
  5417. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  5418. messageSends: [],
  5419. referencedClasses: []
  5420. }),
  5421. smalltalk.Behavior);
  5422. smalltalk.addMethod(
  5423. "_superclass",
  5424. smalltalk.method({
  5425. selector: "superclass",
  5426. category: 'accessing',
  5427. fn: function (){
  5428. var self=this;
  5429. return self.superclass || nil;
  5430. ;
  5431. return self},
  5432. args: [],
  5433. source: "superclass\x0a\x09<return self.superclass || nil>",
  5434. messageSends: [],
  5435. referencedClasses: []
  5436. }),
  5437. smalltalk.Behavior);
  5438. smalltalk.addMethod(
  5439. "_theMetaClass",
  5440. smalltalk.method({
  5441. selector: "theMetaClass",
  5442. category: 'accessing',
  5443. fn: function (){
  5444. var self=this;
  5445. var $1;
  5446. $1=smalltalk.send(self,"_class",[]);
  5447. return $1;
  5448. },
  5449. args: [],
  5450. source: "theMetaClass\x0a\x09^ self class",
  5451. messageSends: ["class"],
  5452. referencedClasses: []
  5453. }),
  5454. smalltalk.Behavior);
  5455. smalltalk.addMethod(
  5456. "_theNonMetaClass",
  5457. smalltalk.method({
  5458. selector: "theNonMetaClass",
  5459. category: 'accessing',
  5460. fn: function (){
  5461. var self=this;
  5462. return self;
  5463. },
  5464. args: [],
  5465. source: "theNonMetaClass\x0a\x09^ self",
  5466. messageSends: [],
  5467. referencedClasses: []
  5468. }),
  5469. smalltalk.Behavior);
  5470. smalltalk.addMethod(
  5471. "_withAllSubclasses",
  5472. smalltalk.method({
  5473. selector: "withAllSubclasses",
  5474. category: 'accessing',
  5475. fn: function (){
  5476. var self=this;
  5477. var $2,$3,$1;
  5478. $2=smalltalk.send((smalltalk.Array || Array),"_with_",[self]);
  5479. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_allSubclasses",[])]);
  5480. $3=smalltalk.send($2,"_yourself",[]);
  5481. $1=$3;
  5482. return $1;
  5483. },
  5484. args: [],
  5485. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  5486. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  5487. referencedClasses: ["Array"]
  5488. }),
  5489. smalltalk.Behavior);
  5490. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  5491. smalltalk.Class.comment="Class is __the__ class object. \x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
  5492. smalltalk.addMethod(
  5493. "_asJavascript",
  5494. smalltalk.method({
  5495. selector: "asJavascript",
  5496. category: 'converting',
  5497. fn: function (){
  5498. var self=this;
  5499. var $1;
  5500. $1=smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_name",[])]);
  5501. return $1;
  5502. },
  5503. args: [],
  5504. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  5505. messageSends: [",", "name"],
  5506. referencedClasses: []
  5507. }),
  5508. smalltalk.Class);
  5509. smalltalk.addMethod(
  5510. "_category",
  5511. smalltalk.method({
  5512. selector: "category",
  5513. category: 'accessing',
  5514. fn: function (){
  5515. var self=this;
  5516. var $2,$1;
  5517. $2=smalltalk.send(self,"_package",[]);
  5518. if(($receiver = $2) == nil || $receiver == undefined){
  5519. $1="Unclassified";
  5520. } else {
  5521. $1=smalltalk.send(smalltalk.send(self,"_package",[]),"_name",[]);
  5522. };
  5523. return $1;
  5524. },
  5525. args: [],
  5526. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  5527. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  5528. referencedClasses: []
  5529. }),
  5530. smalltalk.Class);
  5531. smalltalk.addMethod(
  5532. "_definition",
  5533. smalltalk.method({
  5534. selector: "definition",
  5535. category: 'accessing',
  5536. fn: function (){
  5537. var self=this;
  5538. var $2,$3,$1;
  5539. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  5540. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_asString",[])]);
  5541. smalltalk.send(stream,"_nextPutAll_",[" subclass: #"]);
  5542. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_name",[])]);
  5543. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send((smalltalk.String || String),"_lf",[]),"__comma",[smalltalk.send((smalltalk.String || String),"_tab",[])])]);
  5544. $2=smalltalk.send(stream,"_nextPutAll_",["instanceVariableNames: '"]);
  5545. $2;
  5546. smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
  5547. return smalltalk.send(stream,"_nextPutAll_",[each]);
  5548. }),(function(){
  5549. return smalltalk.send(stream,"_nextPutAll_",[" "]);
  5550. })]);
  5551. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",[smalltalk.send((smalltalk.String || String),"_tab",[])])]);
  5552. smalltalk.send(stream,"_nextPutAll_",["package: '"]);
  5553. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_category",[])]);
  5554. $3=smalltalk.send(stream,"_nextPutAll_",["'"]);
  5555. return $3;
  5556. })]);
  5557. return $1;
  5558. },
  5559. args: [],
  5560. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09nextPutAll: self superclass asString;\x0a\x09 \x09nextPutAll: ' subclass: #';\x0a\x09 \x09nextPutAll: self name;\x0a\x09 \x09nextPutAll: String lf, String tab;\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames \x0a \x09do: [ :each | stream nextPutAll: each ] \x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09 \x09nextPutAll: '''', String lf, String tab;\x0a\x09 \x09nextPutAll: 'package: ''';\x0a\x09 \x09nextPutAll: self category;\x0a\x09 \x09nextPutAll: '''' ]",
  5561. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  5562. referencedClasses: ["String"]
  5563. }),
  5564. smalltalk.Class);
  5565. smalltalk.addMethod(
  5566. "_isClass",
  5567. smalltalk.method({
  5568. selector: "isClass",
  5569. category: 'testing',
  5570. fn: function (){
  5571. var self=this;
  5572. return true;
  5573. },
  5574. args: [],
  5575. source: "isClass\x0a\x09^true",
  5576. messageSends: [],
  5577. referencedClasses: []
  5578. }),
  5579. smalltalk.Class);
  5580. smalltalk.addMethod(
  5581. "_package",
  5582. smalltalk.method({
  5583. selector: "package",
  5584. category: 'accessing',
  5585. fn: function (){
  5586. var self=this;
  5587. return self.pkg;
  5588. ;
  5589. return self},
  5590. args: [],
  5591. source: "package\x0a\x09<return self.pkg>",
  5592. messageSends: [],
  5593. referencedClasses: []
  5594. }),
  5595. smalltalk.Class);
  5596. smalltalk.addMethod(
  5597. "_package_",
  5598. smalltalk.method({
  5599. selector: "package:",
  5600. category: 'accessing',
  5601. fn: function (aPackage){
  5602. var self=this;
  5603. self.pkg = aPackage;
  5604. ;
  5605. return self},
  5606. args: ["aPackage"],
  5607. source: "package: aPackage\x0a\x09<self.pkg = aPackage>",
  5608. messageSends: [],
  5609. referencedClasses: []
  5610. }),
  5611. smalltalk.Class);
  5612. smalltalk.addMethod(
  5613. "_printString",
  5614. smalltalk.method({
  5615. selector: "printString",
  5616. category: 'printing',
  5617. fn: function (){
  5618. var self=this;
  5619. var $1;
  5620. $1=smalltalk.send(self,"_name",[]);
  5621. return $1;
  5622. },
  5623. args: [],
  5624. source: "printString\x0a\x09^self name",
  5625. messageSends: ["name"],
  5626. referencedClasses: []
  5627. }),
  5628. smalltalk.Class);
  5629. smalltalk.addMethod(
  5630. "_rename_",
  5631. smalltalk.method({
  5632. selector: "rename:",
  5633. category: 'accessing',
  5634. fn: function (aString){
  5635. var self=this;
  5636. smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_renameClass_to_",[self,aString]);
  5637. return self},
  5638. args: ["aString"],
  5639. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  5640. messageSends: ["renameClass:to:", "new"],
  5641. referencedClasses: ["ClassBuilder"]
  5642. }),
  5643. smalltalk.Class);
  5644. smalltalk.addMethod(
  5645. "_subclass_instanceVariableNames_",
  5646. smalltalk.method({
  5647. selector: "subclass:instanceVariableNames:",
  5648. category: 'class creation',
  5649. fn: function (aString,anotherString){
  5650. var self=this;
  5651. var $1;
  5652. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,anotherString,nil]);
  5653. return $1;
  5654. },
  5655. args: ["aString", "anotherString"],
  5656. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  5657. messageSends: ["subclass:instanceVariableNames:package:"],
  5658. referencedClasses: []
  5659. }),
  5660. smalltalk.Class);
  5661. smalltalk.addMethod(
  5662. "_subclass_instanceVariableNames_category_",
  5663. smalltalk.method({
  5664. selector: "subclass:instanceVariableNames:category:",
  5665. category: 'class creation',
  5666. fn: function (aString,aString2,aString3){
  5667. var self=this;
  5668. var $1;
  5669. smalltalk.send(self,"_deprecatedAPI",[]);
  5670. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,aString2,aString3]);
  5671. return $1;
  5672. },
  5673. args: ["aString", "aString2", "aString3"],
  5674. 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",
  5675. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5676. referencedClasses: []
  5677. }),
  5678. smalltalk.Class);
  5679. smalltalk.addMethod(
  5680. "_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_",
  5681. smalltalk.method({
  5682. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5683. category: 'class creation',
  5684. fn: function (aString,aString2,classVars,pools,aString3){
  5685. var self=this;
  5686. var $1;
  5687. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,aString2,aString3]);
  5688. return $1;
  5689. },
  5690. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5691. 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",
  5692. messageSends: ["subclass:instanceVariableNames:package:"],
  5693. referencedClasses: []
  5694. }),
  5695. smalltalk.Class);
  5696. smalltalk.addMethod(
  5697. "_subclass_instanceVariableNames_package_",
  5698. smalltalk.method({
  5699. selector: "subclass:instanceVariableNames:package:",
  5700. category: 'class creation',
  5701. fn: function (aString,aString2,aString3){
  5702. var self=this;
  5703. var $1;
  5704. $1=smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_superclass_subclass_instanceVariableNames_package_",[self,smalltalk.send(aString,"_asString",[]),aString2,aString3]);
  5705. return $1;
  5706. },
  5707. args: ["aString", "aString2", "aString3"],
  5708. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5709. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  5710. referencedClasses: ["ClassBuilder"]
  5711. }),
  5712. smalltalk.Class);
  5713. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  5714. 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."
  5715. smalltalk.addMethod(
  5716. "_asJavascript",
  5717. smalltalk.method({
  5718. selector: "asJavascript",
  5719. category: 'converting',
  5720. fn: function (){
  5721. var self=this;
  5722. var $1;
  5723. $1=smalltalk.send(smalltalk.send("smalltalk.","__comma",[smalltalk.send(smalltalk.send(self,"_instanceClass",[]),"_name",[])]),"__comma",[".klass"]);
  5724. return $1;
  5725. },
  5726. args: [],
  5727. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  5728. messageSends: [",", "name", "instanceClass"],
  5729. referencedClasses: []
  5730. }),
  5731. smalltalk.Metaclass);
  5732. smalltalk.addMethod(
  5733. "_definition",
  5734. smalltalk.method({
  5735. selector: "definition",
  5736. category: 'accessing',
  5737. fn: function (){
  5738. var self=this;
  5739. var $2,$1;
  5740. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  5741. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_asString",[])]);
  5742. smalltalk.send(stream,"_nextPutAll_",[" class "]);
  5743. $2=smalltalk.send(stream,"_nextPutAll_",["instanceVariableNames: '"]);
  5744. $2;
  5745. smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
  5746. return smalltalk.send(stream,"_nextPutAll_",[each]);
  5747. }),(function(){
  5748. return smalltalk.send(stream,"_nextPutAll_",[" "]);
  5749. })]);
  5750. return smalltalk.send(stream,"_nextPutAll_",["'"]);
  5751. })]);
  5752. return $1;
  5753. },
  5754. args: [],
  5755. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09 \x09nextPutAll: self asString;\x0a\x09 \x09nextPutAll: ' class ';\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09 \x09do: [ :each | stream nextPutAll: each ]\x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  5756. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  5757. referencedClasses: ["String"]
  5758. }),
  5759. smalltalk.Metaclass);
  5760. smalltalk.addMethod(
  5761. "_instanceClass",
  5762. smalltalk.method({
  5763. selector: "instanceClass",
  5764. category: 'accessing',
  5765. fn: function (){
  5766. var self=this;
  5767. return self.instanceClass;
  5768. ;
  5769. return self},
  5770. args: [],
  5771. source: "instanceClass\x0a\x09<return self.instanceClass>",
  5772. messageSends: [],
  5773. referencedClasses: []
  5774. }),
  5775. smalltalk.Metaclass);
  5776. smalltalk.addMethod(
  5777. "_instanceVariableNames_",
  5778. smalltalk.method({
  5779. selector: "instanceVariableNames:",
  5780. category: 'accessing',
  5781. fn: function (aCollection){
  5782. var self=this;
  5783. smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_class_instanceVariableNames_",[self,aCollection]);
  5784. return self},
  5785. args: ["aCollection"],
  5786. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09 class: self instanceVariableNames: aCollection",
  5787. messageSends: ["class:instanceVariableNames:", "new"],
  5788. referencedClasses: ["ClassBuilder"]
  5789. }),
  5790. smalltalk.Metaclass);
  5791. smalltalk.addMethod(
  5792. "_isMetaclass",
  5793. smalltalk.method({
  5794. selector: "isMetaclass",
  5795. category: 'testing',
  5796. fn: function (){
  5797. var self=this;
  5798. return true;
  5799. },
  5800. args: [],
  5801. source: "isMetaclass\x0a\x09^true",
  5802. messageSends: [],
  5803. referencedClasses: []
  5804. }),
  5805. smalltalk.Metaclass);
  5806. smalltalk.addMethod(
  5807. "_printString",
  5808. smalltalk.method({
  5809. selector: "printString",
  5810. category: 'printing',
  5811. fn: function (){
  5812. var self=this;
  5813. var $1;
  5814. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_instanceClass",[]),"_name",[]),"__comma",[" class"]);
  5815. return $1;
  5816. },
  5817. args: [],
  5818. source: "printString\x0a\x09^self instanceClass name, ' class'",
  5819. messageSends: [",", "name", "instanceClass"],
  5820. referencedClasses: []
  5821. }),
  5822. smalltalk.Metaclass);
  5823. smalltalk.addMethod(
  5824. "_theMetaClass",
  5825. smalltalk.method({
  5826. selector: "theMetaClass",
  5827. category: 'accessing',
  5828. fn: function (){
  5829. var self=this;
  5830. return self;
  5831. },
  5832. args: [],
  5833. source: "theMetaClass\x0a\x09^ self",
  5834. messageSends: [],
  5835. referencedClasses: []
  5836. }),
  5837. smalltalk.Metaclass);
  5838. smalltalk.addMethod(
  5839. "_theNonMetaClass",
  5840. smalltalk.method({
  5841. selector: "theNonMetaClass",
  5842. category: 'accessing',
  5843. fn: function (){
  5844. var self=this;
  5845. var $1;
  5846. $1=smalltalk.send(self,"_instanceClass",[]);
  5847. return $1;
  5848. },
  5849. args: [],
  5850. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  5851. messageSends: ["instanceClass"],
  5852. referencedClasses: []
  5853. }),
  5854. smalltalk.Metaclass);
  5855. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  5856. 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:`."
  5857. smalltalk.addMethod(
  5858. "_addSubclassOf_named_instanceVariableNames_",
  5859. smalltalk.method({
  5860. selector: "addSubclassOf:named:instanceVariableNames:",
  5861. category: 'private',
  5862. fn: function (aClass,aString,aCollection){
  5863. var self=this;
  5864. smalltalk.addClass(aString, aClass, aCollection);
  5865. return smalltalk[aString];
  5866. ;
  5867. return self},
  5868. args: ["aClass", "aString", "aCollection"],
  5869. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection\x0a\x09<smalltalk.addClass(aString, aClass, aCollection);\x0a\x09 return smalltalk[aString]>",
  5870. messageSends: [],
  5871. referencedClasses: []
  5872. }),
  5873. smalltalk.ClassBuilder);
  5874. smalltalk.addMethod(
  5875. "_addSubclassOf_named_instanceVariableNames_package_",
  5876. smalltalk.method({
  5877. selector: "addSubclassOf:named:instanceVariableNames:package:",
  5878. category: 'private',
  5879. fn: function (aClass,aString,aCollection,packageName){
  5880. var self=this;
  5881. smalltalk.addClass(aString, aClass, aCollection, packageName);
  5882. return smalltalk[aString];
  5883. ;
  5884. return self},
  5885. args: ["aClass", "aString", "aCollection", "packageName"],
  5886. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09 return smalltalk[aString]>",
  5887. messageSends: [],
  5888. referencedClasses: []
  5889. }),
  5890. smalltalk.ClassBuilder);
  5891. smalltalk.addMethod(
  5892. "_class_instanceVariableNames_",
  5893. smalltalk.method({
  5894. selector: "class:instanceVariableNames:",
  5895. category: 'class creation',
  5896. fn: function (aClass,aString){
  5897. var self=this;
  5898. var $1,$2,$3;
  5899. $1=smalltalk.send(aClass,"_isMetaclass",[]);
  5900. if(! smalltalk.assert($1)){
  5901. smalltalk.send(self,"_error_",[smalltalk.send(smalltalk.send(aClass,"_name",[]),"__comma",[" is not a metaclass"])]);
  5902. };
  5903. smalltalk.send(aClass,"_basicAt_put_",["iVarNames",smalltalk.send(self,"_instanceVariableNamesFor_",[aString])]);
  5904. $2=smalltalk.send((smalltalk.ClassDefinitionChanged || ClassDefinitionChanged),"_new",[]);
  5905. smalltalk.send($2,"_theClass_",[aClass]);
  5906. $3=smalltalk.send($2,"_yourself",[]);
  5907. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$3]);
  5908. smalltalk.send(self,"_setupClass_",[aClass]);
  5909. return self},
  5910. args: ["aClass", "aString"],
  5911. 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 \x0a SystemAnnouncer current\x0a \x09announce: (ClassDefinitionChanged new\x0a \x09theClass: aClass;\x0a yourself).\x0a \x0a\x09self setupClass: aClass",
  5912. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:", "instanceVariableNamesFor:", "announce:", "theClass:", "new", "yourself", "current", "setupClass:"],
  5913. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  5914. }),
  5915. smalltalk.ClassBuilder);
  5916. smalltalk.addMethod(
  5917. "_copyClass_named_",
  5918. smalltalk.method({
  5919. selector: "copyClass:named:",
  5920. category: 'private',
  5921. fn: function (aClass,aString){
  5922. var self=this;
  5923. var newClass;
  5924. newClass=smalltalk.send(self,"_addSubclassOf_named_instanceVariableNames_package_",[smalltalk.send(aClass,"_superclass",[]),aString,smalltalk.send(aClass,"_instanceVariableNames",[]),smalltalk.send(smalltalk.send(aClass,"_package",[]),"_name",[])]);
  5925. smalltalk.send(self,"_setupClass_",[newClass]);
  5926. smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_do_",[(function(each){
  5927. return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[smalltalk.send(each,"_source",[]),newClass,smalltalk.send(each,"_category",[])]);
  5928. })]);
  5929. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_methodDictionary",[]),"_values",[]),"_do_",[(function(each){
  5930. return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[smalltalk.send(each,"_source",[]),smalltalk.send(newClass,"_class",[]),smalltalk.send(each,"_category",[])]);
  5931. })]);
  5932. smalltalk.send(self,"_setupClass_",[newClass]);
  5933. return newClass;
  5934. },
  5935. args: ["aClass", "aString"],
  5936. 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",
  5937. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "setupClass:", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "class"],
  5938. referencedClasses: ["Compiler"]
  5939. }),
  5940. smalltalk.ClassBuilder);
  5941. smalltalk.addMethod(
  5942. "_instanceVariableNamesFor_",
  5943. smalltalk.method({
  5944. selector: "instanceVariableNamesFor:",
  5945. category: 'private',
  5946. fn: function (aString){
  5947. var self=this;
  5948. var $1;
  5949. $1=smalltalk.send(smalltalk.send(aString,"_tokenize_",[" "]),"_reject_",[(function(each){
  5950. return smalltalk.send(each,"_isEmpty",[]);
  5951. })]);
  5952. return $1;
  5953. },
  5954. args: ["aString"],
  5955. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [:each | each isEmpty]",
  5956. messageSends: ["reject:", "isEmpty", "tokenize:"],
  5957. referencedClasses: []
  5958. }),
  5959. smalltalk.ClassBuilder);
  5960. smalltalk.addMethod(
  5961. "_renameClass_to_",
  5962. smalltalk.method({
  5963. selector: "renameClass:to:",
  5964. category: 'class creation',
  5965. fn: function (aClass,aString){
  5966. var self=this;
  5967. var $1,$2;
  5968. smalltalk[aString] = aClass;
  5969. delete smalltalk[aClass.className];
  5970. aClass.className = aString;
  5971. ;
  5972. ;
  5973. $1=smalltalk.send((smalltalk.ClassRenamed || ClassRenamed),"_new",[]);
  5974. smalltalk.send($1,"_theClass_",[aClass]);
  5975. $2=smalltalk.send($1,"_yourself",[]);
  5976. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5977. return self},
  5978. args: ["aClass", "aString"],
  5979. source: "renameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassRenamed new\x0a \x09theClass: aClass;\x0a yourself)\x0a \x09",
  5980. messageSends: ["announce:", "theClass:", "new", "yourself", "current"],
  5981. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  5982. }),
  5983. smalltalk.ClassBuilder);
  5984. smalltalk.addMethod(
  5985. "_setupClass_",
  5986. smalltalk.method({
  5987. selector: "setupClass:",
  5988. category: 'private',
  5989. fn: function (aClass){
  5990. var self=this;
  5991. smalltalk.init(aClass);;
  5992. ;
  5993. return self},
  5994. args: ["aClass"],
  5995. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  5996. messageSends: [],
  5997. referencedClasses: []
  5998. }),
  5999. smalltalk.ClassBuilder);
  6000. smalltalk.addMethod(
  6001. "_superclass_subclass_",
  6002. smalltalk.method({
  6003. selector: "superclass:subclass:",
  6004. category: 'class creation',
  6005. fn: function (aClass,aString){
  6006. var self=this;
  6007. var $1;
  6008. $1=smalltalk.send(self,"_superclass_subclass_instanceVariableNames_package_",[aClass,aString,"",nil]);
  6009. return $1;
  6010. },
  6011. args: ["aClass", "aString"],
  6012. source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
  6013. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  6014. referencedClasses: []
  6015. }),
  6016. smalltalk.ClassBuilder);
  6017. smalltalk.addMethod(
  6018. "_superclass_subclass_instanceVariableNames_package_",
  6019. smalltalk.method({
  6020. selector: "superclass:subclass:instanceVariableNames:package:",
  6021. category: 'class creation',
  6022. fn: function (aClass,aString,aString2,aString3){
  6023. var self=this;
  6024. var $1,$2,$3;
  6025. var newClass;
  6026. if(($receiver = aString3) == nil || $receiver == undefined){
  6027. $1="unclassified";
  6028. } else {
  6029. $1=aString3;
  6030. };
  6031. newClass=smalltalk.send(self,"_addSubclassOf_named_instanceVariableNames_package_",[aClass,aString,smalltalk.send(self,"_instanceVariableNamesFor_",[aString2]),$1]);
  6032. smalltalk.send(self,"_setupClass_",[newClass]);
  6033. $2=smalltalk.send((smalltalk.ClassAdded || ClassAdded),"_new",[]);
  6034. smalltalk.send($2,"_theClass_",[newClass]);
  6035. $3=smalltalk.send($2,"_yourself",[]);
  6036. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$3]);
  6037. return newClass;
  6038. },
  6039. args: ["aClass", "aString", "aString2", "aString3"],
  6040. source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09\x0a newClass := self addSubclassOf: aClass\x0a\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a \x0a SystemAnnouncer current \x0a \x09announce: (ClassAdded new\x0a \x09theClass: newClass;\x0a yourself).\x0a \x0a\x09^newClass",
  6041. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  6042. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  6043. }),
  6044. smalltalk.ClassBuilder);
  6045. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel-Classes');
  6046. smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
  6047. smalltalk.addMethod(
  6048. "_class_category_",
  6049. smalltalk.method({
  6050. selector: "class:category:",
  6051. category: 'accessing',
  6052. fn: function (aClass,aString){
  6053. var self=this;
  6054. self["@class"]=aClass;
  6055. self["@category"]=aString;
  6056. return self},
  6057. args: ["aClass", "aString"],
  6058. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  6059. messageSends: [],
  6060. referencedClasses: []
  6061. }),
  6062. smalltalk.ClassCategoryReader);
  6063. smalltalk.addMethod(
  6064. "_compileMethod_",
  6065. smalltalk.method({
  6066. selector: "compileMethod:",
  6067. category: 'private',
  6068. fn: function (aString){
  6069. var self=this;
  6070. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[aString,self["@class"],self["@category"]]);
  6071. return self},
  6072. args: ["aString"],
  6073. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  6074. messageSends: ["install:forClass:category:", "new"],
  6075. referencedClasses: ["Compiler"]
  6076. }),
  6077. smalltalk.ClassCategoryReader);
  6078. smalltalk.addMethod(
  6079. "_initialize",
  6080. smalltalk.method({
  6081. selector: "initialize",
  6082. category: 'initialization',
  6083. fn: function (){
  6084. var self=this;
  6085. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  6086. self["@chunkParser"]=smalltalk.send((smalltalk.ChunkParser || ChunkParser),"_new",[]);
  6087. return self},
  6088. args: [],
  6089. source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
  6090. messageSends: ["initialize", "new"],
  6091. referencedClasses: ["ChunkParser"]
  6092. }),
  6093. smalltalk.ClassCategoryReader);
  6094. smalltalk.addMethod(
  6095. "_scanFrom_",
  6096. smalltalk.method({
  6097. selector: "scanFrom:",
  6098. category: 'fileIn',
  6099. fn: function (aChunkParser){
  6100. var self=this;
  6101. var chunk;
  6102. smalltalk.send((function(){
  6103. chunk=smalltalk.send(aChunkParser,"_nextChunk",[]);
  6104. chunk;
  6105. return smalltalk.send(chunk,"_isEmpty",[]);
  6106. }),"_whileFalse_",[(function(){
  6107. return smalltalk.send(self,"_compileMethod_",[chunk]);
  6108. })]);
  6109. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_setupClass_",[self["@class"]]);
  6110. return self},
  6111. args: ["aChunkParser"],
  6112. 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",
  6113. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  6114. referencedClasses: ["Compiler"]
  6115. }),
  6116. smalltalk.ClassCategoryReader);
  6117. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel-Classes');
  6118. smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class descriptions stored on a file.\x0aSee `ClassCategoryReader` too."
  6119. smalltalk.addMethod(
  6120. "_class_",
  6121. smalltalk.method({
  6122. selector: "class:",
  6123. category: 'accessing',
  6124. fn: function (aClass){
  6125. var self=this;
  6126. self["@class"]=aClass;
  6127. return self},
  6128. args: ["aClass"],
  6129. source: "class: aClass\x0a\x09class := aClass",
  6130. messageSends: [],
  6131. referencedClasses: []
  6132. }),
  6133. smalltalk.ClassCommentReader);
  6134. smalltalk.addMethod(
  6135. "_initialize",
  6136. smalltalk.method({
  6137. selector: "initialize",
  6138. category: 'initialization',
  6139. fn: function (){
  6140. var self=this;
  6141. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  6142. self["@chunkParser"]=smalltalk.send((smalltalk.ChunkParser || ChunkParser),"_new",[]);
  6143. return self},
  6144. args: [],
  6145. source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
  6146. messageSends: ["initialize", "new"],
  6147. referencedClasses: ["ChunkParser"]
  6148. }),
  6149. smalltalk.ClassCommentReader);
  6150. smalltalk.addMethod(
  6151. "_scanFrom_",
  6152. smalltalk.method({
  6153. selector: "scanFrom:",
  6154. category: 'fileIn',
  6155. fn: function (aChunkParser){
  6156. var self=this;
  6157. var $1;
  6158. var chunk;
  6159. chunk=smalltalk.send(aChunkParser,"_nextChunk",[]);
  6160. $1=smalltalk.send(chunk,"_isEmpty",[]);
  6161. if(! smalltalk.assert($1)){
  6162. smalltalk.send(self,"_setComment_",[chunk]);
  6163. };
  6164. return self},
  6165. args: ["aChunkParser"],
  6166. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09 self setComment: chunk].",
  6167. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  6168. referencedClasses: []
  6169. }),
  6170. smalltalk.ClassCommentReader);
  6171. smalltalk.addMethod(
  6172. "_setComment_",
  6173. smalltalk.method({
  6174. selector: "setComment:",
  6175. category: 'private',
  6176. fn: function (aString){
  6177. var self=this;
  6178. smalltalk.send(self["@class"],"_comment_",[aString]);
  6179. return self},
  6180. args: ["aString"],
  6181. source: "setComment: aString\x0a class comment: aString",
  6182. messageSends: ["comment:"],
  6183. referencedClasses: []
  6184. }),
  6185. smalltalk.ClassCommentReader);
  6186. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  6187. smalltalk.addMethod(
  6188. "_getNodesFrom_",
  6189. smalltalk.method({
  6190. selector: "getNodesFrom:",
  6191. category: 'accessing',
  6192. fn: function (aCollection){
  6193. var self=this;
  6194. var $1;
  6195. var children;
  6196. var others;
  6197. children=[];
  6198. others=[];
  6199. smalltalk.send(aCollection,"_do_",[(function(each){
  6200. $1=smalltalk.send(smalltalk.send(each,"_superclass",[]),"__eq",[smalltalk.send(self,"_theClass",[])]);
  6201. if(smalltalk.assert($1)){
  6202. return smalltalk.send(children,"_add_",[each]);
  6203. } else {
  6204. return smalltalk.send(others,"_add_",[each]);
  6205. };
  6206. })]);
  6207. self["@nodes"]=smalltalk.send(children,"_collect_",[(function(each){
  6208. return smalltalk.send((smalltalk.ClassSorterNode || ClassSorterNode),"_on_classes_level_",[each,others,smalltalk.send(smalltalk.send(self,"_level",[]),"__plus",[(1)])]);
  6209. })]);
  6210. return self},
  6211. args: ["aCollection"],
  6212. 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]",
  6213. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  6214. referencedClasses: ["ClassSorterNode"]
  6215. }),
  6216. smalltalk.ClassSorterNode);
  6217. smalltalk.addMethod(
  6218. "_level",
  6219. smalltalk.method({
  6220. selector: "level",
  6221. category: 'accessing',
  6222. fn: function (){
  6223. var self=this;
  6224. return self["@level"];
  6225. },
  6226. args: [],
  6227. source: "level\x0a\x09^level",
  6228. messageSends: [],
  6229. referencedClasses: []
  6230. }),
  6231. smalltalk.ClassSorterNode);
  6232. smalltalk.addMethod(
  6233. "_level_",
  6234. smalltalk.method({
  6235. selector: "level:",
  6236. category: 'accessing',
  6237. fn: function (anInteger){
  6238. var self=this;
  6239. self["@level"]=anInteger;
  6240. return self},
  6241. args: ["anInteger"],
  6242. source: "level: anInteger\x0a\x09level := anInteger",
  6243. messageSends: [],
  6244. referencedClasses: []
  6245. }),
  6246. smalltalk.ClassSorterNode);
  6247. smalltalk.addMethod(
  6248. "_nodes",
  6249. smalltalk.method({
  6250. selector: "nodes",
  6251. category: 'accessing',
  6252. fn: function (){
  6253. var self=this;
  6254. return self["@nodes"];
  6255. },
  6256. args: [],
  6257. source: "nodes\x0a\x09^nodes",
  6258. messageSends: [],
  6259. referencedClasses: []
  6260. }),
  6261. smalltalk.ClassSorterNode);
  6262. smalltalk.addMethod(
  6263. "_theClass",
  6264. smalltalk.method({
  6265. selector: "theClass",
  6266. category: 'accessing',
  6267. fn: function (){
  6268. var self=this;
  6269. return self["@theClass"];
  6270. },
  6271. args: [],
  6272. source: "theClass\x0a\x09^theClass",
  6273. messageSends: [],
  6274. referencedClasses: []
  6275. }),
  6276. smalltalk.ClassSorterNode);
  6277. smalltalk.addMethod(
  6278. "_theClass_",
  6279. smalltalk.method({
  6280. selector: "theClass:",
  6281. category: 'accessing',
  6282. fn: function (aClass){
  6283. var self=this;
  6284. self["@theClass"]=aClass;
  6285. return self},
  6286. args: ["aClass"],
  6287. source: "theClass: aClass\x0a\x09theClass := aClass",
  6288. messageSends: [],
  6289. referencedClasses: []
  6290. }),
  6291. smalltalk.ClassSorterNode);
  6292. smalltalk.addMethod(
  6293. "_traverseClassesWith_",
  6294. smalltalk.method({
  6295. selector: "traverseClassesWith:",
  6296. category: 'visiting',
  6297. fn: function (aCollection){
  6298. var self=this;
  6299. smalltalk.send(aCollection,"_add_",[smalltalk.send(self,"_theClass",[])]);
  6300. smalltalk.send(smalltalk.send(smalltalk.send(self,"_nodes",[]),"_sorted_",[(function(a,b){
  6301. return smalltalk.send(smalltalk.send(smalltalk.send(a,"_theClass",[]),"_name",[]),"__lt_eq",[smalltalk.send(smalltalk.send(b,"_theClass",[]),"_name",[])]);
  6302. })]),"_do_",[(function(aNode){
  6303. return smalltalk.send(aNode,"_traverseClassesWith_",[aCollection]);
  6304. })]);
  6305. return self},
  6306. args: ["aCollection"],
  6307. 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 ].",
  6308. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  6309. referencedClasses: []
  6310. }),
  6311. smalltalk.ClassSorterNode);
  6312. smalltalk.addMethod(
  6313. "_on_classes_level_",
  6314. smalltalk.method({
  6315. selector: "on:classes:level:",
  6316. category: 'instance creation',
  6317. fn: function (aClass,aCollection,anInteger){
  6318. var self=this;
  6319. var $2,$3,$1;
  6320. $2=smalltalk.send(self,"_new",[]);
  6321. smalltalk.send($2,"_theClass_",[aClass]);
  6322. smalltalk.send($2,"_level_",[anInteger]);
  6323. smalltalk.send($2,"_getNodesFrom_",[aCollection]);
  6324. $3=smalltalk.send($2,"_yourself",[]);
  6325. $1=$3;
  6326. return $1;
  6327. },
  6328. args: ["aClass", "aCollection", "anInteger"],
  6329. 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",
  6330. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  6331. referencedClasses: []
  6332. }),
  6333. smalltalk.ClassSorterNode.klass);
  6334. smalltalk.addPackage('Kernel-Methods', {});
  6335. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  6336. 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."
  6337. smalltalk.addMethod(
  6338. "_applyTo_arguments_",
  6339. smalltalk.method({
  6340. selector: "applyTo:arguments:",
  6341. category: 'evaluating',
  6342. fn: function (anObject, aCollection) {
  6343. var self = this;
  6344. return self.apply(anObject, aCollection);
  6345. return self;
  6346. },
  6347. args: ["anObject", "aCollection"],
  6348. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  6349. messageSends: [],
  6350. referencedClasses: []
  6351. }),
  6352. smalltalk.BlockClosure);
  6353. smalltalk.addMethod(
  6354. "_compiledSource",
  6355. smalltalk.method({
  6356. selector: "compiledSource",
  6357. category: 'accessing',
  6358. fn: function () {
  6359. var self = this;
  6360. return self.toString();
  6361. return self;
  6362. },
  6363. args: [],
  6364. source: "compiledSource\x0a\x09<return self.toString()>",
  6365. messageSends: [],
  6366. referencedClasses: []
  6367. }),
  6368. smalltalk.BlockClosure);
  6369. smalltalk.addMethod(
  6370. "_ensure_",
  6371. smalltalk.method({
  6372. selector: "ensure:",
  6373. category: 'evaluating',
  6374. fn: function (aBlock){
  6375. var self=this;
  6376. try{return self()}finally{aBlock._value()};
  6377. ;
  6378. return self},
  6379. args: ["aBlock"],
  6380. source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
  6381. messageSends: [],
  6382. referencedClasses: []
  6383. }),
  6384. smalltalk.BlockClosure);
  6385. smalltalk.addMethod(
  6386. "_fork",
  6387. smalltalk.method({
  6388. selector: "fork",
  6389. category: 'timeout/interval',
  6390. fn: function (){
  6391. var self=this;
  6392. smalltalk.send(smalltalk.send((smalltalk.ForkPool || ForkPool),"_default",[]),"_fork_",[self]);
  6393. return self},
  6394. args: [],
  6395. source: "fork\x0a\x09ForkPool default fork: self",
  6396. messageSends: ["fork:", "default"],
  6397. referencedClasses: ["ForkPool"]
  6398. }),
  6399. smalltalk.BlockClosure);
  6400. smalltalk.addMethod(
  6401. "_new",
  6402. smalltalk.method({
  6403. selector: "new",
  6404. category: 'evaluating',
  6405. fn: function () {
  6406. var self = this;
  6407. return new self;
  6408. return self;
  6409. },
  6410. args: [],
  6411. 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()>",
  6412. messageSends: [],
  6413. referencedClasses: []
  6414. }),
  6415. smalltalk.BlockClosure);
  6416. smalltalk.addMethod(
  6417. "_newValue_",
  6418. smalltalk.method({
  6419. selector: "newValue:",
  6420. category: 'evaluating',
  6421. fn: function (anObject) {
  6422. var self = this;
  6423. return new self(anObject);
  6424. return self;
  6425. },
  6426. args: ["anObject"],
  6427. 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)>",
  6428. messageSends: [],
  6429. referencedClasses: []
  6430. }),
  6431. smalltalk.BlockClosure);
  6432. smalltalk.addMethod(
  6433. "_newValue_value_",
  6434. smalltalk.method({
  6435. selector: "newValue:value:",
  6436. category: 'evaluating',
  6437. fn: function (anObject, anObject2) {
  6438. var self = this;
  6439. return new self(anObject, anObject2);
  6440. return self;
  6441. },
  6442. args: ["anObject", "anObject2"],
  6443. 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)>",
  6444. messageSends: [],
  6445. referencedClasses: []
  6446. }),
  6447. smalltalk.BlockClosure);
  6448. smalltalk.addMethod(
  6449. "_newValue_value_value_",
  6450. smalltalk.method({
  6451. selector: "newValue:value:value:",
  6452. category: 'evaluating',
  6453. fn: function (anObject, anObject2, anObject3) {
  6454. var self = this;
  6455. return new self(anObject, anObject2);
  6456. return self;
  6457. },
  6458. args: ["anObject", "anObject2", "anObject3"],
  6459. 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)>",
  6460. messageSends: [],
  6461. referencedClasses: []
  6462. }),
  6463. smalltalk.BlockClosure);
  6464. smalltalk.addMethod(
  6465. "_numArgs",
  6466. smalltalk.method({
  6467. selector: "numArgs",
  6468. category: 'accessing',
  6469. fn: function () {
  6470. var self = this;
  6471. return self.length;
  6472. return self;
  6473. },
  6474. args: [],
  6475. source: "numArgs\x0a\x09<return self.length>",
  6476. messageSends: [],
  6477. referencedClasses: []
  6478. }),
  6479. smalltalk.BlockClosure);
  6480. smalltalk.addMethod(
  6481. "_on_do_",
  6482. smalltalk.method({
  6483. selector: "on:do:",
  6484. category: 'error handling',
  6485. fn: function (anErrorClass, aBlock) {
  6486. var self = this;
  6487. var $2, $1;
  6488. $1 = smalltalk.send(self, "_try_catch_", [self, function (error) {$2 = smalltalk.send(error, "_isKindOf_", [anErrorClass]);if (smalltalk.assert($2)) {return smalltalk.send(aBlock, "_value_", [error]);} else {return smalltalk.send(error, "_signal", []);}}]);
  6489. return $1;
  6490. },
  6491. args: ["anErrorClass", "aBlock"],
  6492. 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]]",
  6493. messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
  6494. referencedClasses: []
  6495. }),
  6496. smalltalk.BlockClosure);
  6497. smalltalk.addMethod(
  6498. "_timeToRun",
  6499. smalltalk.method({
  6500. selector: "timeToRun",
  6501. category: 'evaluating',
  6502. fn: function () {
  6503. var self = this;
  6504. var $1;
  6505. $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
  6506. return $1;
  6507. },
  6508. args: [],
  6509. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  6510. messageSends: ["millisecondsToRun:"],
  6511. referencedClasses: ["Date"]
  6512. }),
  6513. smalltalk.BlockClosure);
  6514. smalltalk.addMethod(
  6515. "_value",
  6516. smalltalk.method({
  6517. selector: "value",
  6518. category: 'evaluating',
  6519. fn: function () {
  6520. var self = this;
  6521. return self();
  6522. return self;
  6523. },
  6524. args: [],
  6525. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  6526. messageSends: [],
  6527. referencedClasses: []
  6528. }),
  6529. smalltalk.BlockClosure);
  6530. smalltalk.addMethod(
  6531. "_value_",
  6532. smalltalk.method({
  6533. selector: "value:",
  6534. category: 'evaluating',
  6535. fn: function (anArg) {
  6536. var self = this;
  6537. return self(anArg);
  6538. return self;
  6539. },
  6540. args: ["anArg"],
  6541. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  6542. messageSends: [],
  6543. referencedClasses: []
  6544. }),
  6545. smalltalk.BlockClosure);
  6546. smalltalk.addMethod(
  6547. "_value_value_",
  6548. smalltalk.method({
  6549. selector: "value:value:",
  6550. category: 'evaluating',
  6551. fn: function (firstArg, secondArg) {
  6552. var self = this;
  6553. return self(firstArg, secondArg);
  6554. return self;
  6555. },
  6556. args: ["firstArg", "secondArg"],
  6557. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  6558. messageSends: [],
  6559. referencedClasses: []
  6560. }),
  6561. smalltalk.BlockClosure);
  6562. smalltalk.addMethod(
  6563. "_value_value_value_",
  6564. smalltalk.method({
  6565. selector: "value:value:value:",
  6566. category: 'evaluating',
  6567. fn: function (firstArg, secondArg, thirdArg) {
  6568. var self = this;
  6569. return self(firstArg, secondArg, thirdArg);
  6570. return self;
  6571. },
  6572. args: ["firstArg", "secondArg", "thirdArg"],
  6573. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  6574. messageSends: [],
  6575. referencedClasses: []
  6576. }),
  6577. smalltalk.BlockClosure);
  6578. smalltalk.addMethod(
  6579. "_valueWithInterval_",
  6580. smalltalk.method({
  6581. selector: "valueWithInterval:",
  6582. category: 'timeout/interval',
  6583. fn: function (aNumber) {
  6584. var self = this;
  6585. return setInterval(self, aNumber);
  6586. return self;
  6587. },
  6588. args: ["aNumber"],
  6589. source: "valueWithInterval: aNumber\x0a\x09<return setInterval(self, aNumber)>",
  6590. messageSends: [],
  6591. referencedClasses: []
  6592. }),
  6593. smalltalk.BlockClosure);
  6594. smalltalk.addMethod(
  6595. "_valueWithPossibleArguments_",
  6596. smalltalk.method({
  6597. selector: "valueWithPossibleArguments:",
  6598. category: 'evaluating',
  6599. fn: function (aCollection) {
  6600. var self = this;
  6601. return self.apply(null, aCollection);
  6602. return self;
  6603. },
  6604. args: ["aCollection"],
  6605. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  6606. messageSends: [],
  6607. referencedClasses: []
  6608. }),
  6609. smalltalk.BlockClosure);
  6610. smalltalk.addMethod(
  6611. "_valueWithTimeout_",
  6612. smalltalk.method({
  6613. selector: "valueWithTimeout:",
  6614. category: 'timeout/interval',
  6615. fn: function (aNumber) {
  6616. var self = this;
  6617. return setTimeout(self, aNumber);
  6618. return self;
  6619. },
  6620. args: ["aNumber"],
  6621. source: "valueWithTimeout: aNumber\x0a\x09<return setTimeout(self, aNumber)>",
  6622. messageSends: [],
  6623. referencedClasses: []
  6624. }),
  6625. smalltalk.BlockClosure);
  6626. smalltalk.addMethod(
  6627. "_whileFalse",
  6628. smalltalk.method({
  6629. selector: "whileFalse",
  6630. category: 'controlling',
  6631. fn: function () {
  6632. var self = this;
  6633. smalltalk.send(self, "_whileFalse_", [function () {}]);
  6634. return self;
  6635. },
  6636. args: [],
  6637. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  6638. messageSends: ["whileFalse:"],
  6639. referencedClasses: []
  6640. }),
  6641. smalltalk.BlockClosure);
  6642. smalltalk.addMethod(
  6643. "_whileFalse_",
  6644. smalltalk.method({
  6645. selector: "whileFalse:",
  6646. category: 'controlling',
  6647. fn: function (aBlock) {
  6648. var self = this;
  6649. while (!self()) {
  6650. aBlock();
  6651. }
  6652. return self;
  6653. },
  6654. args: ["aBlock"],
  6655. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  6656. messageSends: [],
  6657. referencedClasses: []
  6658. }),
  6659. smalltalk.BlockClosure);
  6660. smalltalk.addMethod(
  6661. "_whileTrue",
  6662. smalltalk.method({
  6663. selector: "whileTrue",
  6664. category: 'controlling',
  6665. fn: function () {
  6666. var self = this;
  6667. smalltalk.send(self, "_whileTrue_", [function () {}]);
  6668. return self;
  6669. },
  6670. args: [],
  6671. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  6672. messageSends: ["whileTrue:"],
  6673. referencedClasses: []
  6674. }),
  6675. smalltalk.BlockClosure);
  6676. smalltalk.addMethod(
  6677. "_whileTrue_",
  6678. smalltalk.method({
  6679. selector: "whileTrue:",
  6680. category: 'controlling',
  6681. fn: function (aBlock) {
  6682. var self = this;
  6683. while (self()) {
  6684. aBlock();
  6685. }
  6686. return self;
  6687. },
  6688. args: ["aBlock"],
  6689. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  6690. messageSends: [],
  6691. referencedClasses: []
  6692. }),
  6693. smalltalk.BlockClosure);
  6694. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  6695. 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"
  6696. smalltalk.addMethod(
  6697. "_arguments",
  6698. smalltalk.method({
  6699. selector: "arguments",
  6700. category: 'accessing',
  6701. fn: function () {
  6702. var self = this;
  6703. return self.args || [];
  6704. return self;
  6705. },
  6706. args: [],
  6707. source: "arguments\x0a\x09<return self.args || []>",
  6708. messageSends: [],
  6709. referencedClasses: []
  6710. }),
  6711. smalltalk.CompiledMethod);
  6712. smalltalk.addMethod(
  6713. "_category",
  6714. smalltalk.method({
  6715. selector: "category",
  6716. category: 'accessing',
  6717. fn: function () {
  6718. var self = this;
  6719. var $2, $1;
  6720. $2 = smalltalk.send(self, "_basicAt_", ["category"]);
  6721. if (($receiver = $2) == nil || $receiver == undefined) {
  6722. $1 = "";
  6723. } else {
  6724. $1 = $2;
  6725. }
  6726. return $1;
  6727. },
  6728. args: [],
  6729. source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
  6730. messageSends: ["ifNil:", "basicAt:"],
  6731. referencedClasses: []
  6732. }),
  6733. smalltalk.CompiledMethod);
  6734. smalltalk.addMethod(
  6735. "_category_",
  6736. smalltalk.method({
  6737. selector: "category:",
  6738. category: 'accessing',
  6739. fn: function (aString){
  6740. var self=this;
  6741. var $1;
  6742. var oldCategory;
  6743. oldCategory=smalltalk.send(self,"_category",[]);
  6744. smalltalk.send(self,"_basicAt_put_",["category",aString]);
  6745. $1=smalltalk.send(self,"_methodClass",[]);
  6746. if(($receiver = $1) == nil || $receiver == undefined){
  6747. $1;
  6748. } else {
  6749. smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
  6750. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
  6751. return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
  6752. })]),"_ifEmpty_",[(function(){
  6753. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
  6754. })]);
  6755. };
  6756. return self},
  6757. args: ["aString"],
  6758. source: "category: aString\x0a\x09| oldCategory |\x0a oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a \x0a self methodClass ifNotNil: [\x0a \x09self methodClass organization addElement: aString.\x0a \x0a\x09\x09(self methodClass methods \x0a \x09\x09select: [ :each | each category = oldCategory ])\x0a \x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
  6759. messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  6760. referencedClasses: []
  6761. }),
  6762. smalltalk.CompiledMethod);
  6763. smalltalk.addMethod(
  6764. "_fn",
  6765. smalltalk.method({
  6766. selector: "fn",
  6767. category: 'accessing',
  6768. fn: function () {
  6769. var self = this;
  6770. var $1;
  6771. $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
  6772. return $1;
  6773. },
  6774. args: [],
  6775. source: "fn\x0a\x09^self basicAt: 'fn'",
  6776. messageSends: ["basicAt:"],
  6777. referencedClasses: []
  6778. }),
  6779. smalltalk.CompiledMethod);
  6780. smalltalk.addMethod(
  6781. "_fn_",
  6782. smalltalk.method({
  6783. selector: "fn:",
  6784. category: 'accessing',
  6785. fn: function (aBlock) {
  6786. var self = this;
  6787. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  6788. return self;
  6789. },
  6790. args: ["aBlock"],
  6791. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  6792. messageSends: ["basicAt:put:"],
  6793. referencedClasses: []
  6794. }),
  6795. smalltalk.CompiledMethod);
  6796. smalltalk.addMethod(
  6797. "_messageSends",
  6798. smalltalk.method({
  6799. selector: "messageSends",
  6800. category: 'accessing',
  6801. fn: function () {
  6802. var self = this;
  6803. var $1;
  6804. $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
  6805. return $1;
  6806. },
  6807. args: [],
  6808. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  6809. messageSends: ["basicAt:"],
  6810. referencedClasses: []
  6811. }),
  6812. smalltalk.CompiledMethod);
  6813. smalltalk.addMethod(
  6814. "_methodClass",
  6815. smalltalk.method({
  6816. selector: "methodClass",
  6817. category: 'accessing',
  6818. fn: function () {
  6819. var self = this;
  6820. var $1;
  6821. $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
  6822. return $1;
  6823. },
  6824. args: [],
  6825. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  6826. messageSends: ["basicAt:"],
  6827. referencedClasses: []
  6828. }),
  6829. smalltalk.CompiledMethod);
  6830. smalltalk.addMethod(
  6831. "_protocol",
  6832. smalltalk.method({
  6833. selector: "protocol",
  6834. category: 'accessing',
  6835. fn: function () {
  6836. var self = this;
  6837. var $1;
  6838. $1 = smalltalk.send(self, "_category", []);
  6839. return $1;
  6840. },
  6841. args: [],
  6842. source: "protocol\x0a\x09^ self category",
  6843. messageSends: ["category"],
  6844. referencedClasses: []
  6845. }),
  6846. smalltalk.CompiledMethod);
  6847. smalltalk.addMethod(
  6848. "_referencedClasses",
  6849. smalltalk.method({
  6850. selector: "referencedClasses",
  6851. category: 'accessing',
  6852. fn: function () {
  6853. var self = this;
  6854. var $1;
  6855. $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  6856. return $1;
  6857. },
  6858. args: [],
  6859. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  6860. messageSends: ["basicAt:"],
  6861. referencedClasses: []
  6862. }),
  6863. smalltalk.CompiledMethod);
  6864. smalltalk.addMethod(
  6865. "_selector",
  6866. smalltalk.method({
  6867. selector: "selector",
  6868. category: 'accessing',
  6869. fn: function () {
  6870. var self = this;
  6871. var $1;
  6872. $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
  6873. return $1;
  6874. },
  6875. args: [],
  6876. source: "selector\x0a\x09^self basicAt: 'selector'",
  6877. messageSends: ["basicAt:"],
  6878. referencedClasses: []
  6879. }),
  6880. smalltalk.CompiledMethod);
  6881. smalltalk.addMethod(
  6882. "_selector_",
  6883. smalltalk.method({
  6884. selector: "selector:",
  6885. category: 'accessing',
  6886. fn: function (aString) {
  6887. var self = this;
  6888. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  6889. return self;
  6890. },
  6891. args: ["aString"],
  6892. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  6893. messageSends: ["basicAt:put:"],
  6894. referencedClasses: []
  6895. }),
  6896. smalltalk.CompiledMethod);
  6897. smalltalk.addMethod(
  6898. "_source",
  6899. smalltalk.method({
  6900. selector: "source",
  6901. category: 'accessing',
  6902. fn: function () {
  6903. var self = this;
  6904. var $2, $1;
  6905. $2 = smalltalk.send(self, "_basicAt_", ["source"]);
  6906. if (($receiver = $2) == nil || $receiver == undefined) {
  6907. $1 = "";
  6908. } else {
  6909. $1 = $2;
  6910. }
  6911. return $1;
  6912. },
  6913. args: [],
  6914. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  6915. messageSends: ["ifNil:", "basicAt:"],
  6916. referencedClasses: []
  6917. }),
  6918. smalltalk.CompiledMethod);
  6919. smalltalk.addMethod(
  6920. "_source_",
  6921. smalltalk.method({
  6922. selector: "source:",
  6923. category: 'accessing',
  6924. fn: function (aString) {
  6925. var self = this;
  6926. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  6927. return self;
  6928. },
  6929. args: ["aString"],
  6930. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  6931. messageSends: ["basicAt:put:"],
  6932. referencedClasses: []
  6933. }),
  6934. smalltalk.CompiledMethod);
  6935. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  6936. smalltalk.addMethod(
  6937. "_addWorker",
  6938. smalltalk.method({
  6939. selector: "addWorker",
  6940. category: 'action',
  6941. fn: function (){
  6942. var self=this;
  6943. smalltalk.send(self["@worker"],"_valueWithTimeout_",[(0)]);
  6944. self["@poolSize"]=smalltalk.send(self["@poolSize"],"__plus",[(1)]);
  6945. return self},
  6946. args: [],
  6947. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a poolSize := poolSize + 1",
  6948. messageSends: ["valueWithTimeout:", "+"],
  6949. referencedClasses: []
  6950. }),
  6951. smalltalk.ForkPool);
  6952. smalltalk.addMethod(
  6953. "_fork_",
  6954. smalltalk.method({
  6955. selector: "fork:",
  6956. category: 'action',
  6957. fn: function (aBlock){
  6958. var self=this;
  6959. var $1;
  6960. $1=smalltalk.send(self["@poolSize"],"__lt",[self["@maxPoolSize"]]);
  6961. if(smalltalk.assert($1)){
  6962. smalltalk.send(self,"_addWorker",[]);
  6963. };
  6964. smalltalk.send(self["@queue"],"_back_",[aBlock]);
  6965. return self},
  6966. args: ["aBlock"],
  6967. source: "fork: aBlock\x0a\x09poolSize < maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
  6968. messageSends: ["ifTrue:", "addWorker", "<", "back:"],
  6969. referencedClasses: []
  6970. }),
  6971. smalltalk.ForkPool);
  6972. smalltalk.addMethod(
  6973. "_initialize",
  6974. smalltalk.method({
  6975. selector: "initialize",
  6976. category: 'initialization',
  6977. fn: function (){
  6978. var self=this;
  6979. var $1;
  6980. var sentinel;
  6981. self["@poolSize"]=(0);
  6982. self["@maxPoolSize"]=smalltalk.send(smalltalk.send(self,"_class",[]),"_defaultMaxPoolSize",[]);
  6983. self["@queue"]=smalltalk.send((smalltalk.Queue || Queue),"_new",[]);
  6984. sentinel=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  6985. self["@worker"]=(function(){
  6986. var block;
  6987. self["@poolSize"]=smalltalk.send(self["@poolSize"],"__minus",[(1)]);
  6988. self["@poolSize"];
  6989. block=smalltalk.send(self["@queue"],"_frontIfAbsent_",[(function(){
  6990. return sentinel;
  6991. })]);
  6992. block;
  6993. $1=smalltalk.send(block,"__eq_eq",[sentinel]);
  6994. if(! smalltalk.assert($1)){
  6995. return smalltalk.send((function(){
  6996. return smalltalk.send(block,"_value",[]);
  6997. }),"_ensure_",[(function(){
  6998. return smalltalk.send(self,"_addWorker",[]);
  6999. })]);
  7000. };
  7001. });
  7002. return self},
  7003. args: [],
  7004. source: "initialize\x0a\x09| sentinel |\x0a\x09poolSize := 0.\x0a maxPoolSize := self class defaultMaxPoolSize.\x0a queue := Queue new.\x0a sentinel := Object new.\x0a worker := [\x0a\x09\x09| block |\x0a poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a block == sentinel ifFalse: [\x0a \x09[ block value ] ensure: [ self addWorker ]]].",
  7005. messageSends: ["defaultMaxPoolSize", "class", "new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  7006. referencedClasses: ["Queue", "Object"]
  7007. }),
  7008. smalltalk.ForkPool);
  7009. smalltalk.ForkPool.klass.iVarNames = ['default'];
  7010. smalltalk.addMethod(
  7011. "_default",
  7012. smalltalk.method({
  7013. selector: "default",
  7014. category: 'accessing',
  7015. fn: function (){
  7016. var self=this;
  7017. var $1;
  7018. if(($receiver = self["@default"]) == nil || $receiver == undefined){
  7019. self["@default"]=smalltalk.send(self,"_new",[]);
  7020. $1=self["@default"];
  7021. } else {
  7022. $1=self["@default"];
  7023. };
  7024. return $1;
  7025. },
  7026. args: [],
  7027. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  7028. messageSends: ["ifNil:", "new"],
  7029. referencedClasses: []
  7030. }),
  7031. smalltalk.ForkPool.klass);
  7032. smalltalk.addMethod(
  7033. "_defaultMaxPoolSize",
  7034. smalltalk.method({
  7035. selector: "defaultMaxPoolSize",
  7036. category: 'accessing',
  7037. fn: function (){
  7038. var self=this;
  7039. return (100);
  7040. },
  7041. args: [],
  7042. source: "defaultMaxPoolSize\x0a\x09^100",
  7043. messageSends: [],
  7044. referencedClasses: []
  7045. }),
  7046. smalltalk.ForkPool.klass);
  7047. smalltalk.addMethod(
  7048. "_resetDefault",
  7049. smalltalk.method({
  7050. selector: "resetDefault",
  7051. category: 'accessing',
  7052. fn: function (){
  7053. var self=this;
  7054. self["@default"]=nil;
  7055. return self},
  7056. args: [],
  7057. source: "resetDefault\x0a\x09default := nil",
  7058. messageSends: [],
  7059. referencedClasses: []
  7060. }),
  7061. smalltalk.ForkPool.klass);
  7062. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  7063. 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:`"
  7064. smalltalk.addMethod(
  7065. "_arguments",
  7066. smalltalk.method({
  7067. selector: "arguments",
  7068. category: 'accessing',
  7069. fn: function () {
  7070. var self = this;
  7071. return self['@arguments'];
  7072. },
  7073. args: [],
  7074. source: "arguments\x0a\x09^arguments",
  7075. messageSends: [],
  7076. referencedClasses: []
  7077. }),
  7078. smalltalk.Message);
  7079. smalltalk.addMethod(
  7080. "_arguments_",
  7081. smalltalk.method({
  7082. selector: "arguments:",
  7083. category: 'accessing',
  7084. fn: function (anArray) {
  7085. var self = this;
  7086. self['@arguments'] = anArray;
  7087. return self;
  7088. },
  7089. args: ["anArray"],
  7090. source: "arguments: anArray\x0a\x09arguments := anArray",
  7091. messageSends: [],
  7092. referencedClasses: []
  7093. }),
  7094. smalltalk.Message);
  7095. smalltalk.addMethod(
  7096. "_printString",
  7097. smalltalk.method({
  7098. selector: "printString",
  7099. category: 'printing',
  7100. fn: function () {
  7101. var self = this;
  7102. var $2, $1;
  7103. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send(aStream, "_nextPutAll_", ["("]);smalltalk.send(aStream, "_nextPutAll_", [self['@selector']]);$2 = smalltalk.send(aStream, "_nextPutAll_", [")"]);return $2;}]);
  7104. return $1;
  7105. },
  7106. args: [],
  7107. 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]",
  7108. messageSends: ["streamContents:", "nextPutAll:", "printString"],
  7109. referencedClasses: ["String"]
  7110. }),
  7111. smalltalk.Message);
  7112. smalltalk.addMethod(
  7113. "_selector",
  7114. smalltalk.method({
  7115. selector: "selector",
  7116. category: 'accessing',
  7117. fn: function () {
  7118. var self = this;
  7119. return self['@selector'];
  7120. },
  7121. args: [],
  7122. source: "selector\x0a\x09^selector",
  7123. messageSends: [],
  7124. referencedClasses: []
  7125. }),
  7126. smalltalk.Message);
  7127. smalltalk.addMethod(
  7128. "_selector_",
  7129. smalltalk.method({
  7130. selector: "selector:",
  7131. category: 'accessing',
  7132. fn: function (aString) {
  7133. var self = this;
  7134. self['@selector'] = aString;
  7135. return self;
  7136. },
  7137. args: ["aString"],
  7138. source: "selector: aString\x0a\x09selector := aString",
  7139. messageSends: [],
  7140. referencedClasses: []
  7141. }),
  7142. smalltalk.Message);
  7143. smalltalk.addMethod(
  7144. "_sendTo_",
  7145. smalltalk.method({
  7146. selector: "sendTo:",
  7147. category: 'printing',
  7148. fn: function (anObject) {
  7149. var self = this;
  7150. var $1;
  7151. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
  7152. return $1;
  7153. },
  7154. args: ["anObject"],
  7155. source: "sendTo: anObject\x0a\x09^ Smalltalk current send: self selector to: anObject arguments: self arguments",
  7156. messageSends: ["send:to:arguments:", "selector", "arguments", "current"],
  7157. referencedClasses: ["Smalltalk"]
  7158. }),
  7159. smalltalk.Message);
  7160. smalltalk.addMethod(
  7161. "_selector_arguments_",
  7162. smalltalk.method({
  7163. selector: "selector:arguments:",
  7164. category: 'instance creation',
  7165. fn: function (aString, anArray) {
  7166. var self = this;
  7167. var $2, $3, $1;
  7168. $2 = smalltalk.send(self, "_new", []);
  7169. smalltalk.send($2, "_selector_", [aString]);
  7170. smalltalk.send($2, "_arguments_", [anArray]);
  7171. $3 = smalltalk.send($2, "_yourself", []);
  7172. $1 = $3;
  7173. return $1;
  7174. },
  7175. args: ["aString", "anArray"],
  7176. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  7177. messageSends: ["selector:", "new", "arguments:", "yourself"],
  7178. referencedClasses: []
  7179. }),
  7180. smalltalk.Message.klass);
  7181. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  7182. 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."
  7183. smalltalk.addMethod(
  7184. "_asString",
  7185. smalltalk.method({
  7186. selector: "asString",
  7187. category: 'accessing',
  7188. fn: function () {
  7189. var self = this;
  7190. var $1;
  7191. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
  7192. return $1;
  7193. },
  7194. args: [],
  7195. source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
  7196. messageSends: [",", "selector", "printString", "class", "receiver"],
  7197. referencedClasses: []
  7198. }),
  7199. smalltalk.MethodContext);
  7200. smalltalk.addMethod(
  7201. "_home",
  7202. smalltalk.method({
  7203. selector: "home",
  7204. category: 'accessing',
  7205. fn: function () {
  7206. var self = this;
  7207. return self.homeContext;
  7208. return self;
  7209. },
  7210. args: [],
  7211. source: "home\x0a\x09<return self.homeContext>",
  7212. messageSends: [],
  7213. referencedClasses: []
  7214. }),
  7215. smalltalk.MethodContext);
  7216. smalltalk.addMethod(
  7217. "_pc",
  7218. smalltalk.method({
  7219. selector: "pc",
  7220. category: 'accessing',
  7221. fn: function () {
  7222. var self = this;
  7223. return self.pc;
  7224. return self;
  7225. },
  7226. args: [],
  7227. source: "pc\x0a\x09<return self.pc>",
  7228. messageSends: [],
  7229. referencedClasses: []
  7230. }),
  7231. smalltalk.MethodContext);
  7232. smalltalk.addMethod(
  7233. "_printString",
  7234. smalltalk.method({
  7235. selector: "printString",
  7236. category: 'accessing',
  7237. fn: function () {
  7238. var self = this;
  7239. var $1;
  7240. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
  7241. return $1;
  7242. },
  7243. args: [],
  7244. source: "printString\x0a\x09^super printString, '(', self asString, ')'",
  7245. messageSends: [",", "asString", "printString"],
  7246. referencedClasses: []
  7247. }),
  7248. smalltalk.MethodContext);
  7249. smalltalk.addMethod(
  7250. "_receiver",
  7251. smalltalk.method({
  7252. selector: "receiver",
  7253. category: 'accessing',
  7254. fn: function () {
  7255. var self = this;
  7256. return self.receiver;
  7257. return self;
  7258. },
  7259. args: [],
  7260. source: "receiver\x0a\x09<return self.receiver>",
  7261. messageSends: [],
  7262. referencedClasses: []
  7263. }),
  7264. smalltalk.MethodContext);
  7265. smalltalk.addMethod(
  7266. "_selector",
  7267. smalltalk.method({
  7268. selector: "selector",
  7269. category: 'accessing',
  7270. fn: function () {
  7271. var self = this;
  7272. return smalltalk.convertSelector(self.selector);
  7273. return self;
  7274. },
  7275. args: [],
  7276. source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
  7277. messageSends: [],
  7278. referencedClasses: []
  7279. }),
  7280. smalltalk.MethodContext);
  7281. smalltalk.addMethod(
  7282. "_temps",
  7283. smalltalk.method({
  7284. selector: "temps",
  7285. category: 'accessing',
  7286. fn: function () {
  7287. var self = this;
  7288. return self.temps;
  7289. return self;
  7290. },
  7291. args: [],
  7292. source: "temps\x0a\x09<return self.temps>",
  7293. messageSends: [],
  7294. referencedClasses: []
  7295. }),
  7296. smalltalk.MethodContext);
  7297. smalltalk.addPackage('Kernel-Collections', {});
  7298. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  7299. smalltalk.addMethod(
  7300. "__eq",
  7301. smalltalk.method({
  7302. selector: "=",
  7303. category: 'comparing',
  7304. fn: function (anAssociation){
  7305. var self=this;
  7306. var $1;
  7307. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(anAssociation,"_class",[])]),"_and_",[(function(){
  7308. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_key",[]),"__eq",[smalltalk.send(anAssociation,"_key",[])]),"_and_",[(function(){
  7309. return smalltalk.send(smalltalk.send(self,"_value",[]),"__eq",[smalltalk.send(anAssociation,"_value",[])]);
  7310. })]);
  7311. })]);
  7312. return $1;
  7313. },
  7314. args: ["anAssociation"],
  7315. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09 self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  7316. messageSends: ["and:", "=", "value", "key", "class"],
  7317. referencedClasses: []
  7318. }),
  7319. smalltalk.Association);
  7320. smalltalk.addMethod(
  7321. "_key",
  7322. smalltalk.method({
  7323. selector: "key",
  7324. category: 'accessing',
  7325. fn: function (){
  7326. var self=this;
  7327. return self["@key"];
  7328. },
  7329. args: [],
  7330. source: "key\x0a\x09^key",
  7331. messageSends: [],
  7332. referencedClasses: []
  7333. }),
  7334. smalltalk.Association);
  7335. smalltalk.addMethod(
  7336. "_key_",
  7337. smalltalk.method({
  7338. selector: "key:",
  7339. category: 'accessing',
  7340. fn: function (aKey){
  7341. var self=this;
  7342. self["@key"]=aKey;
  7343. return self},
  7344. args: ["aKey"],
  7345. source: "key: aKey\x0a\x09key := aKey",
  7346. messageSends: [],
  7347. referencedClasses: []
  7348. }),
  7349. smalltalk.Association);
  7350. smalltalk.addMethod(
  7351. "_printString",
  7352. smalltalk.method({
  7353. selector: "printString",
  7354. category: 'printing',
  7355. fn: function (){
  7356. var self=this;
  7357. var $1;
  7358. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  7359. return smalltalk.send(self,"_storeOn_",[aStream]);
  7360. })]);
  7361. return $1;
  7362. },
  7363. args: [],
  7364. source: "printString\x0a\x09\x22print the contents of the Association into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09self storeOn: aStream]",
  7365. messageSends: ["streamContents:", "storeOn:"],
  7366. referencedClasses: ["String"]
  7367. }),
  7368. smalltalk.Association);
  7369. smalltalk.addMethod(
  7370. "_storeOn_",
  7371. smalltalk.method({
  7372. selector: "storeOn:",
  7373. category: 'printing',
  7374. fn: function (aStream){
  7375. var self=this;
  7376. smalltalk.send(self["@key"],"_storeOn_",[aStream]);
  7377. smalltalk.send(aStream,"_nextPutAll_",["->"]);
  7378. smalltalk.send(self["@value"],"_storeOn_",[aStream]);
  7379. return self},
  7380. args: ["aStream"],
  7381. source: "storeOn: aStream\x0a\x09\x22Store in the format: key->value\x22\x0a\x0a\x09key storeOn: aStream.\x0a\x09aStream nextPutAll: '->'.\x0a\x09value storeOn: aStream.",
  7382. messageSends: ["storeOn:", "nextPutAll:"],
  7383. referencedClasses: []
  7384. }),
  7385. smalltalk.Association);
  7386. smalltalk.addMethod(
  7387. "_value",
  7388. smalltalk.method({
  7389. selector: "value",
  7390. category: 'accessing',
  7391. fn: function (){
  7392. var self=this;
  7393. return self["@value"];
  7394. },
  7395. args: [],
  7396. source: "value\x0a\x09^value",
  7397. messageSends: [],
  7398. referencedClasses: []
  7399. }),
  7400. smalltalk.Association);
  7401. smalltalk.addMethod(
  7402. "_value_",
  7403. smalltalk.method({
  7404. selector: "value:",
  7405. category: 'accessing',
  7406. fn: function (aValue){
  7407. var self=this;
  7408. self["@value"]=aValue;
  7409. return self},
  7410. args: ["aValue"],
  7411. source: "value: aValue\x0a\x09value := aValue",
  7412. messageSends: [],
  7413. referencedClasses: []
  7414. }),
  7415. smalltalk.Association);
  7416. smalltalk.addMethod(
  7417. "_key_value_",
  7418. smalltalk.method({
  7419. selector: "key:value:",
  7420. category: 'instance creation',
  7421. fn: function (aKey,aValue){
  7422. var self=this;
  7423. var $2,$3,$1;
  7424. $2=smalltalk.send(self,"_new",[]);
  7425. smalltalk.send($2,"_key_",[aKey]);
  7426. smalltalk.send($2,"_value_",[aValue]);
  7427. $3=smalltalk.send($2,"_yourself",[]);
  7428. $1=$3;
  7429. return $1;
  7430. },
  7431. args: ["aKey", "aValue"],
  7432. source: "key: aKey value: aValue\x0a\x09 ^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7433. messageSends: ["key:", "new", "value:", "yourself"],
  7434. referencedClasses: []
  7435. }),
  7436. smalltalk.Association.klass);
  7437. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  7438. smalltalk.addMethod(
  7439. "__comma",
  7440. smalltalk.method({
  7441. selector: ",",
  7442. category: 'copying',
  7443. fn: function (aCollection){
  7444. var self=this;
  7445. var $2,$3,$1;
  7446. $2=smalltalk.send(self,"_copy",[]);
  7447. smalltalk.send($2,"_addAll_",[aCollection]);
  7448. $3=smalltalk.send($2,"_yourself",[]);
  7449. $1=$3;
  7450. return $1;
  7451. },
  7452. args: ["aCollection"],
  7453. source: ", aCollection\x0a\x09^self copy \x0a\x09 addAll: aCollection; \x0a\x09 yourself",
  7454. messageSends: ["addAll:", "copy", "yourself"],
  7455. referencedClasses: []
  7456. }),
  7457. smalltalk.Collection);
  7458. smalltalk.addMethod(
  7459. "_add_",
  7460. smalltalk.method({
  7461. selector: "add:",
  7462. category: 'adding/removing',
  7463. fn: function (anObject){
  7464. var self=this;
  7465. smalltalk.send(self,"_subclassResponsibility",[]);
  7466. return self},
  7467. args: ["anObject"],
  7468. source: "add: anObject\x0a\x09self subclassResponsibility",
  7469. messageSends: ["subclassResponsibility"],
  7470. referencedClasses: []
  7471. }),
  7472. smalltalk.Collection);
  7473. smalltalk.addMethod(
  7474. "_addAll_",
  7475. smalltalk.method({
  7476. selector: "addAll:",
  7477. category: 'adding/removing',
  7478. fn: function (aCollection){
  7479. var self=this;
  7480. smalltalk.send(aCollection,"_do_",[(function(each){
  7481. return smalltalk.send(self,"_add_",[each]);
  7482. })]);
  7483. return aCollection;
  7484. },
  7485. args: ["aCollection"],
  7486. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self add: each].\x0a\x09^aCollection",
  7487. messageSends: ["do:", "add:"],
  7488. referencedClasses: []
  7489. }),
  7490. smalltalk.Collection);
  7491. smalltalk.addMethod(
  7492. "_asArray",
  7493. smalltalk.method({
  7494. selector: "asArray",
  7495. category: 'converting',
  7496. fn: function (){
  7497. var self=this;
  7498. var $1;
  7499. $1=smalltalk.send((smalltalk.Array || Array),"_withAll_",[self]);
  7500. return $1;
  7501. },
  7502. args: [],
  7503. source: "asArray\x0a\x09^Array withAll: self",
  7504. messageSends: ["withAll:"],
  7505. referencedClasses: ["Array"]
  7506. }),
  7507. smalltalk.Collection);
  7508. smalltalk.addMethod(
  7509. "_asJSON",
  7510. smalltalk.method({
  7511. selector: "asJSON",
  7512. category: 'converting',
  7513. fn: function (){
  7514. var self=this;
  7515. var $1;
  7516. $1=smalltalk.send(smalltalk.send(self,"_asArray",[]),"_collect_",[(function(each){
  7517. return smalltalk.send(each,"_asJSON",[]);
  7518. })]);
  7519. return $1;
  7520. },
  7521. args: [],
  7522. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  7523. messageSends: ["collect:", "asJSON", "asArray"],
  7524. referencedClasses: []
  7525. }),
  7526. smalltalk.Collection);
  7527. smalltalk.addMethod(
  7528. "_asOrderedCollection",
  7529. smalltalk.method({
  7530. selector: "asOrderedCollection",
  7531. category: 'converting',
  7532. fn: function (){
  7533. var self=this;
  7534. var $1;
  7535. $1=smalltalk.send(self,"_asArray",[]);
  7536. return $1;
  7537. },
  7538. args: [],
  7539. source: "asOrderedCollection\x0a\x09^self asArray",
  7540. messageSends: ["asArray"],
  7541. referencedClasses: []
  7542. }),
  7543. smalltalk.Collection);
  7544. smalltalk.addMethod(
  7545. "_asSet",
  7546. smalltalk.method({
  7547. selector: "asSet",
  7548. category: 'converting',
  7549. fn: function (){
  7550. var self=this;
  7551. var $1;
  7552. $1=smalltalk.send((smalltalk.Set || Set),"_withAll_",[self]);
  7553. return $1;
  7554. },
  7555. args: [],
  7556. source: "asSet\x0a\x09^Set withAll: self",
  7557. messageSends: ["withAll:"],
  7558. referencedClasses: ["Set"]
  7559. }),
  7560. smalltalk.Collection);
  7561. smalltalk.addMethod(
  7562. "_collect_",
  7563. smalltalk.method({
  7564. selector: "collect:",
  7565. category: 'enumerating',
  7566. fn: function (aBlock){
  7567. var self=this;
  7568. var $1;
  7569. var stream;
  7570. stream=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]),"_writeStream",[]);
  7571. smalltalk.send(self,"_do_",[(function(each){
  7572. return smalltalk.send(stream,"_nextPut_",[smalltalk.send(aBlock,"_value_",[each])]);
  7573. })]);
  7574. $1=smalltalk.send(stream,"_contents",[]);
  7575. return $1;
  7576. },
  7577. args: ["aBlock"],
  7578. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^stream contents",
  7579. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  7580. referencedClasses: []
  7581. }),
  7582. smalltalk.Collection);
  7583. smalltalk.addMethod(
  7584. "_copyWith_",
  7585. smalltalk.method({
  7586. selector: "copyWith:",
  7587. category: 'copying',
  7588. fn: function (anObject){
  7589. var self=this;
  7590. var $2,$3,$1;
  7591. $2=smalltalk.send(self,"_copy",[]);
  7592. smalltalk.send($2,"_add_",[anObject]);
  7593. $3=smalltalk.send($2,"_yourself",[]);
  7594. $1=$3;
  7595. return $1;
  7596. },
  7597. args: ["anObject"],
  7598. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  7599. messageSends: ["add:", "copy", "yourself"],
  7600. referencedClasses: []
  7601. }),
  7602. smalltalk.Collection);
  7603. smalltalk.addMethod(
  7604. "_copyWithAll_",
  7605. smalltalk.method({
  7606. selector: "copyWithAll:",
  7607. category: 'copying',
  7608. fn: function (aCollection){
  7609. var self=this;
  7610. var $2,$3,$1;
  7611. $2=smalltalk.send(self,"_copy",[]);
  7612. smalltalk.send($2,"_addAll_",[aCollection]);
  7613. $3=smalltalk.send($2,"_yourself",[]);
  7614. $1=$3;
  7615. return $1;
  7616. },
  7617. args: ["aCollection"],
  7618. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  7619. messageSends: ["addAll:", "copy", "yourself"],
  7620. referencedClasses: []
  7621. }),
  7622. smalltalk.Collection);
  7623. smalltalk.addMethod(
  7624. "_copyWithoutAll_",
  7625. smalltalk.method({
  7626. selector: "copyWithoutAll:",
  7627. category: 'copying',
  7628. fn: function (aCollection){
  7629. var self=this;
  7630. var $1;
  7631. $1=smalltalk.send(self,"_reject_",[(function(each){
  7632. return smalltalk.send(aCollection,"_includes_",[each]);
  7633. })]);
  7634. return $1;
  7635. },
  7636. args: ["aCollection"],
  7637. 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]",
  7638. messageSends: ["reject:", "includes:"],
  7639. referencedClasses: []
  7640. }),
  7641. smalltalk.Collection);
  7642. smalltalk.addMethod(
  7643. "_detect_",
  7644. smalltalk.method({
  7645. selector: "detect:",
  7646. category: 'enumerating',
  7647. fn: function (aBlock){
  7648. var self=this;
  7649. var $1;
  7650. $1=smalltalk.send(self,"_detect_ifNone_",[aBlock,(function(){
  7651. return smalltalk.send(self,"_errorNotFound",[]);
  7652. })]);
  7653. return $1;
  7654. },
  7655. args: ["aBlock"],
  7656. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  7657. messageSends: ["detect:ifNone:", "errorNotFound"],
  7658. referencedClasses: []
  7659. }),
  7660. smalltalk.Collection);
  7661. smalltalk.addMethod(
  7662. "_detect_ifNone_",
  7663. smalltalk.method({
  7664. selector: "detect:ifNone:",
  7665. category: 'enumerating',
  7666. fn: function (aBlock,anotherBlock){
  7667. var self=this;
  7668. for(var i = 0; i < self.length; i++)
  7669. if(aBlock(self[i]))
  7670. return self[i];
  7671. return anotherBlock();
  7672. ;
  7673. ;
  7674. return self},
  7675. args: ["aBlock", "anotherBlock"],
  7676. 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>",
  7677. messageSends: [],
  7678. referencedClasses: []
  7679. }),
  7680. smalltalk.Collection);
  7681. smalltalk.addMethod(
  7682. "_do_",
  7683. smalltalk.method({
  7684. selector: "do:",
  7685. category: 'enumerating',
  7686. fn: function (aBlock){
  7687. var self=this;
  7688. for(var i=0;i<self.length;i++){aBlock(self[i]);};
  7689. ;
  7690. return self},
  7691. args: ["aBlock"],
  7692. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  7693. messageSends: [],
  7694. referencedClasses: []
  7695. }),
  7696. smalltalk.Collection);
  7697. smalltalk.addMethod(
  7698. "_do_separatedBy_",
  7699. smalltalk.method({
  7700. selector: "do:separatedBy:",
  7701. category: 'enumerating',
  7702. fn: function (aBlock,anotherBlock){
  7703. var self=this;
  7704. var first;
  7705. first=true;
  7706. smalltalk.send(self,"_do_",[(function(each){
  7707. if(smalltalk.assert(first)){
  7708. first=false;
  7709. first;
  7710. } else {
  7711. smalltalk.send(anotherBlock,"_value",[]);
  7712. };
  7713. return smalltalk.send(aBlock,"_value_",[each]);
  7714. })]);
  7715. return self},
  7716. args: ["aBlock", "anotherBlock"],
  7717. 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]",
  7718. messageSends: ["do:", "ifTrue:ifFalse:", "value", "value:"],
  7719. referencedClasses: []
  7720. }),
  7721. smalltalk.Collection);
  7722. smalltalk.addMethod(
  7723. "_errorNotFound",
  7724. smalltalk.method({
  7725. selector: "errorNotFound",
  7726. category: 'error handling',
  7727. fn: function (){
  7728. var self=this;
  7729. smalltalk.send(self,"_error_",["Object is not in the collection"]);
  7730. return self},
  7731. args: [],
  7732. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7733. messageSends: ["error:"],
  7734. referencedClasses: []
  7735. }),
  7736. smalltalk.Collection);
  7737. smalltalk.addMethod(
  7738. "_ifEmpty_",
  7739. smalltalk.method({
  7740. selector: "ifEmpty:",
  7741. category: 'testing',
  7742. fn: function (aBlock){
  7743. var self=this;
  7744. var $2,$1;
  7745. $2=smalltalk.send(self,"_isEmpty",[]);
  7746. if(smalltalk.assert($2)){
  7747. $1=smalltalk.send(aBlock,"_value",[]);
  7748. } else {
  7749. $1=self;
  7750. };
  7751. return $1;
  7752. },
  7753. args: ["aBlock"],
  7754. 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 ]",
  7755. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  7756. referencedClasses: []
  7757. }),
  7758. smalltalk.Collection);
  7759. smalltalk.addMethod(
  7760. "_ifNotEmpty_",
  7761. smalltalk.method({
  7762. selector: "ifNotEmpty:",
  7763. category: 'testing',
  7764. fn: function (aBlock){
  7765. var self=this;
  7766. var $1;
  7767. $1=smalltalk.send(self,"_notEmpty",[]);
  7768. smalltalk.send($1,"_ifTrue_",[aBlock]);
  7769. return self},
  7770. args: ["aBlock"],
  7771. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  7772. messageSends: ["ifTrue:", "notEmpty"],
  7773. referencedClasses: []
  7774. }),
  7775. smalltalk.Collection);
  7776. smalltalk.addMethod(
  7777. "_includes_",
  7778. smalltalk.method({
  7779. selector: "includes:",
  7780. category: 'testing',
  7781. fn: function (anObject){
  7782. var self=this;
  7783. var i = self.length;
  7784. while (i--) {
  7785. if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
  7786. }
  7787. return false
  7788. ;
  7789. ;
  7790. return self},
  7791. args: ["anObject"],
  7792. 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>",
  7793. messageSends: [],
  7794. referencedClasses: []
  7795. }),
  7796. smalltalk.Collection);
  7797. smalltalk.addMethod(
  7798. "_inject_into_",
  7799. smalltalk.method({
  7800. selector: "inject:into:",
  7801. category: 'enumerating',
  7802. fn: function (anObject,aBlock){
  7803. var self=this;
  7804. var result;
  7805. result=anObject;
  7806. smalltalk.send(self,"_do_",[(function(each){
  7807. result=smalltalk.send(aBlock,"_value_value_",[result,each]);
  7808. return result;
  7809. })]);
  7810. return result;
  7811. },
  7812. args: ["anObject", "aBlock"],
  7813. 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",
  7814. messageSends: ["do:", "value:value:"],
  7815. referencedClasses: []
  7816. }),
  7817. smalltalk.Collection);
  7818. smalltalk.addMethod(
  7819. "_intersection_",
  7820. smalltalk.method({
  7821. selector: "intersection:",
  7822. category: 'enumerating',
  7823. fn: function (aCollection){
  7824. var self=this;
  7825. var $1,$2;
  7826. var set;
  7827. var outputSet;
  7828. set=smalltalk.send(self,"_asSet",[]);
  7829. outputSet=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  7830. smalltalk.send(aCollection,"_do_",[(function(each){
  7831. $1=smalltalk.send(smalltalk.send(set,"_includes_",[each]),"_and_",[(function(){
  7832. return smalltalk.send(smalltalk.send(outputSet,"_includes_",[each]),"_not",[]);
  7833. })]);
  7834. if(smalltalk.assert($1)){
  7835. return smalltalk.send(outputSet,"_add_",[each]);
  7836. };
  7837. })]);
  7838. $2=smalltalk.send(smalltalk.send(self,"_class",[]),"_withAll_",[smalltalk.send(outputSet,"_asArray",[])]);
  7839. return $2;
  7840. },
  7841. args: ["aCollection"],
  7842. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [(outputSet includes: each) not])\x0a\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09outputSet add: each]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  7843. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  7844. referencedClasses: ["Set"]
  7845. }),
  7846. smalltalk.Collection);
  7847. smalltalk.addMethod(
  7848. "_isEmpty",
  7849. smalltalk.method({
  7850. selector: "isEmpty",
  7851. category: 'testing',
  7852. fn: function (){
  7853. var self=this;
  7854. var $1;
  7855. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  7856. return $1;
  7857. },
  7858. args: [],
  7859. source: "isEmpty\x0a\x09^self size = 0",
  7860. messageSends: ["=", "size"],
  7861. referencedClasses: []
  7862. }),
  7863. smalltalk.Collection);
  7864. smalltalk.addMethod(
  7865. "_notEmpty",
  7866. smalltalk.method({
  7867. selector: "notEmpty",
  7868. category: 'testing',
  7869. fn: function (){
  7870. var self=this;
  7871. var $1;
  7872. $1=smalltalk.send(smalltalk.send(self,"_isEmpty",[]),"_not",[]);
  7873. return $1;
  7874. },
  7875. args: [],
  7876. source: "notEmpty\x0a\x09^self isEmpty not",
  7877. messageSends: ["not", "isEmpty"],
  7878. referencedClasses: []
  7879. }),
  7880. smalltalk.Collection);
  7881. smalltalk.addMethod(
  7882. "_occurrencesOf_",
  7883. smalltalk.method({
  7884. selector: "occurrencesOf:",
  7885. category: 'accessing',
  7886. fn: function (anObject){
  7887. var self=this;
  7888. var $1;
  7889. var tally;
  7890. tally=(0);
  7891. smalltalk.send(self,"_do_",[(function(each){
  7892. $1=smalltalk.send(anObject,"__eq",[each]);
  7893. if(smalltalk.assert($1)){
  7894. tally=smalltalk.send(tally,"__plus",[(1)]);
  7895. return tally;
  7896. };
  7897. })]);
  7898. return tally;
  7899. },
  7900. args: ["anObject"],
  7901. source: "occurrencesOf: anObject \x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [:each | anObject = each ifTrue: [tally := tally + 1]].\x0a\x09^tally",
  7902. messageSends: ["do:", "ifTrue:", "+", "="],
  7903. referencedClasses: []
  7904. }),
  7905. smalltalk.Collection);
  7906. smalltalk.addMethod(
  7907. "_printString",
  7908. smalltalk.method({
  7909. selector: "printString",
  7910. category: 'printing',
  7911. fn: function (){
  7912. var self=this;
  7913. var $1;
  7914. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  7915. smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_printString",[],smalltalk.Object),"__comma",[" ("])]);
  7916. smalltalk.send(self,"_do_separatedBy_",[(function(each){
  7917. return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(each,"_printString",[])]);
  7918. }),(function(){
  7919. return smalltalk.send(aStream,"_nextPutAll_",[" "]);
  7920. })]);
  7921. return smalltalk.send(aStream,"_nextPutAll_",[")"]);
  7922. })]);
  7923. return $1;
  7924. },
  7925. args: [],
  7926. source: "printString\x0a\x09\x22print the contents of the Collection into a string and return it\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: super printString, ' ('.\x0a\x09\x09self do: [:each | aStream nextPutAll: each printString]\x0a\x09\x09\x09separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream nextPutAll: ')']",
  7927. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "do:separatedBy:"],
  7928. referencedClasses: ["String"]
  7929. }),
  7930. smalltalk.Collection);
  7931. smalltalk.addMethod(
  7932. "_readStream",
  7933. smalltalk.method({
  7934. selector: "readStream",
  7935. category: 'accessing',
  7936. fn: function (){
  7937. var self=this;
  7938. var $1;
  7939. $1=smalltalk.send(self,"_stream",[]);
  7940. return $1;
  7941. },
  7942. args: [],
  7943. source: "readStream\x0a\x09^self stream",
  7944. messageSends: ["stream"],
  7945. referencedClasses: []
  7946. }),
  7947. smalltalk.Collection);
  7948. smalltalk.addMethod(
  7949. "_reject_",
  7950. smalltalk.method({
  7951. selector: "reject:",
  7952. category: 'enumerating',
  7953. fn: function (aBlock){
  7954. var self=this;
  7955. var $1;
  7956. $1=smalltalk.send(self,"_select_",[(function(each){
  7957. return smalltalk.send(smalltalk.send(aBlock,"_value_",[each]),"__eq",[false]);
  7958. })]);
  7959. return $1;
  7960. },
  7961. args: ["aBlock"],
  7962. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  7963. messageSends: ["select:", "=", "value:"],
  7964. referencedClasses: []
  7965. }),
  7966. smalltalk.Collection);
  7967. smalltalk.addMethod(
  7968. "_remove_",
  7969. smalltalk.method({
  7970. selector: "remove:",
  7971. category: 'adding/removing',
  7972. fn: function (anObject){
  7973. var self=this;
  7974. var $1;
  7975. $1=smalltalk.send(self,"_remove_ifAbsent_",[anObject,(function(){
  7976. return smalltalk.send(self,"_errorNotFound",[]);
  7977. })]);
  7978. return $1;
  7979. },
  7980. args: ["anObject"],
  7981. source: "remove: anObject\x0a ^self remove: anObject ifAbsent: [self errorNotFound]",
  7982. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  7983. referencedClasses: []
  7984. }),
  7985. smalltalk.Collection);
  7986. smalltalk.addMethod(
  7987. "_remove_ifAbsent_",
  7988. smalltalk.method({
  7989. selector: "remove:ifAbsent:",
  7990. category: 'adding/removing',
  7991. fn: function (anObject,aBlock){
  7992. var self=this;
  7993. smalltalk.send(self,"_subclassResponsibility",[]);
  7994. return self},
  7995. args: ["anObject", "aBlock"],
  7996. source: "remove: anObject ifAbsent: aBlock\x0a self subclassResponsibility",
  7997. messageSends: ["subclassResponsibility"],
  7998. referencedClasses: []
  7999. }),
  8000. smalltalk.Collection);
  8001. smalltalk.addMethod(
  8002. "_select_",
  8003. smalltalk.method({
  8004. selector: "select:",
  8005. category: 'enumerating',
  8006. fn: function (aBlock){
  8007. var self=this;
  8008. var $1,$2;
  8009. var stream;
  8010. stream=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]),"_writeStream",[]);
  8011. smalltalk.send(self,"_do_",[(function(each){
  8012. $1=smalltalk.send(aBlock,"_value_",[each]);
  8013. if(smalltalk.assert($1)){
  8014. return smalltalk.send(stream,"_nextPut_",[each]);
  8015. };
  8016. })]);
  8017. $2=smalltalk.send(stream,"_contents",[]);
  8018. return $2;
  8019. },
  8020. args: ["aBlock"],
  8021. 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",
  8022. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  8023. referencedClasses: []
  8024. }),
  8025. smalltalk.Collection);
  8026. smalltalk.addMethod(
  8027. "_size",
  8028. smalltalk.method({
  8029. selector: "size",
  8030. category: 'accessing',
  8031. fn: function (){
  8032. var self=this;
  8033. smalltalk.send(self,"_subclassResponsibility",[]);
  8034. return self},
  8035. args: [],
  8036. source: "size\x0a\x09self subclassResponsibility",
  8037. messageSends: ["subclassResponsibility"],
  8038. referencedClasses: []
  8039. }),
  8040. smalltalk.Collection);
  8041. smalltalk.addMethod(
  8042. "_stream",
  8043. smalltalk.method({
  8044. selector: "stream",
  8045. category: 'accessing',
  8046. fn: function (){
  8047. var self=this;
  8048. var $1;
  8049. $1=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[self]);
  8050. return $1;
  8051. },
  8052. args: [],
  8053. source: "stream\x0a\x09^self streamClass on: self",
  8054. messageSends: ["on:", "streamClass"],
  8055. referencedClasses: []
  8056. }),
  8057. smalltalk.Collection);
  8058. smalltalk.addMethod(
  8059. "_streamClass",
  8060. smalltalk.method({
  8061. selector: "streamClass",
  8062. category: 'accessing',
  8063. fn: function (){
  8064. var self=this;
  8065. var $1;
  8066. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_streamClass",[]);
  8067. return $1;
  8068. },
  8069. args: [],
  8070. source: "streamClass\x0a\x09^self class streamClass",
  8071. messageSends: ["streamClass", "class"],
  8072. referencedClasses: []
  8073. }),
  8074. smalltalk.Collection);
  8075. smalltalk.addMethod(
  8076. "_writeStream",
  8077. smalltalk.method({
  8078. selector: "writeStream",
  8079. category: 'accessing',
  8080. fn: function (){
  8081. var self=this;
  8082. var $1;
  8083. $1=smalltalk.send(self,"_stream",[]);
  8084. return $1;
  8085. },
  8086. args: [],
  8087. source: "writeStream\x0a\x09^self stream",
  8088. messageSends: ["stream"],
  8089. referencedClasses: []
  8090. }),
  8091. smalltalk.Collection);
  8092. smalltalk.addMethod(
  8093. "_new_",
  8094. smalltalk.method({
  8095. selector: "new:",
  8096. category: 'instance creation',
  8097. fn: function (anInteger){
  8098. var self=this;
  8099. var $1;
  8100. $1=smalltalk.send(self,"_new",[]);
  8101. return $1;
  8102. },
  8103. args: ["anInteger"],
  8104. source: "new: anInteger\x0a\x09^self new",
  8105. messageSends: ["new"],
  8106. referencedClasses: []
  8107. }),
  8108. smalltalk.Collection.klass);
  8109. smalltalk.addMethod(
  8110. "_streamClass",
  8111. smalltalk.method({
  8112. selector: "streamClass",
  8113. category: 'accessing',
  8114. fn: function (){
  8115. var self=this;
  8116. return (smalltalk.Stream || Stream);
  8117. },
  8118. args: [],
  8119. source: "streamClass\x0a\x09 ^Stream",
  8120. messageSends: [],
  8121. referencedClasses: ["Stream"]
  8122. }),
  8123. smalltalk.Collection.klass);
  8124. smalltalk.addMethod(
  8125. "_with_",
  8126. smalltalk.method({
  8127. selector: "with:",
  8128. category: 'instance creation',
  8129. fn: function (anObject){
  8130. var self=this;
  8131. var $2,$3,$1;
  8132. $2=smalltalk.send(self,"_new",[]);
  8133. smalltalk.send($2,"_add_",[anObject]);
  8134. $3=smalltalk.send($2,"_yourself",[]);
  8135. $1=$3;
  8136. return $1;
  8137. },
  8138. args: ["anObject"],
  8139. source: "with: anObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8140. messageSends: ["add:", "new", "yourself"],
  8141. referencedClasses: []
  8142. }),
  8143. smalltalk.Collection.klass);
  8144. smalltalk.addMethod(
  8145. "_with_with_",
  8146. smalltalk.method({
  8147. selector: "with:with:",
  8148. category: 'instance creation',
  8149. fn: function (anObject,anotherObject){
  8150. var self=this;
  8151. var $2,$3,$1;
  8152. $2=smalltalk.send(self,"_new",[]);
  8153. smalltalk.send($2,"_add_",[anObject]);
  8154. smalltalk.send($2,"_add_",[anotherObject]);
  8155. $3=smalltalk.send($2,"_yourself",[]);
  8156. $1=$3;
  8157. return $1;
  8158. },
  8159. args: ["anObject", "anotherObject"],
  8160. source: "with: anObject with: anotherObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8161. messageSends: ["add:", "new", "yourself"],
  8162. referencedClasses: []
  8163. }),
  8164. smalltalk.Collection.klass);
  8165. smalltalk.addMethod(
  8166. "_with_with_with_",
  8167. smalltalk.method({
  8168. selector: "with:with:with:",
  8169. category: 'instance creation',
  8170. fn: function (firstObject,secondObject,thirdObject){
  8171. var self=this;
  8172. var $2,$3,$1;
  8173. $2=smalltalk.send(self,"_new",[]);
  8174. smalltalk.send($2,"_add_",[firstObject]);
  8175. smalltalk.send($2,"_add_",[secondObject]);
  8176. smalltalk.send($2,"_add_",[thirdObject]);
  8177. $3=smalltalk.send($2,"_yourself",[]);
  8178. $1=$3;
  8179. return $1;
  8180. },
  8181. args: ["firstObject", "secondObject", "thirdObject"],
  8182. 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",
  8183. messageSends: ["add:", "new", "yourself"],
  8184. referencedClasses: []
  8185. }),
  8186. smalltalk.Collection.klass);
  8187. smalltalk.addMethod(
  8188. "_withAll_",
  8189. smalltalk.method({
  8190. selector: "withAll:",
  8191. category: 'instance creation',
  8192. fn: function (aCollection){
  8193. var self=this;
  8194. var $2,$3,$1;
  8195. $2=smalltalk.send(self,"_new",[]);
  8196. smalltalk.send($2,"_addAll_",[aCollection]);
  8197. $3=smalltalk.send($2,"_yourself",[]);
  8198. $1=$3;
  8199. return $1;
  8200. },
  8201. args: ["aCollection"],
  8202. source: "withAll: aCollection\x0a\x09 ^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8203. messageSends: ["addAll:", "new", "yourself"],
  8204. referencedClasses: []
  8205. }),
  8206. smalltalk.Collection.klass);
  8207. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  8208. 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."
  8209. smalltalk.addMethod(
  8210. "__comma",
  8211. smalltalk.method({
  8212. selector: ",",
  8213. category: 'copying',
  8214. fn: function (aCollection){
  8215. var self=this;
  8216. smalltalk.send(self,"_shouldNotImplement",[]);
  8217. return self},
  8218. args: ["aCollection"],
  8219. source: ", aCollection\x0a\x09self shouldNotImplement",
  8220. messageSends: ["shouldNotImplement"],
  8221. referencedClasses: []
  8222. }),
  8223. smalltalk.HashedCollection);
  8224. smalltalk.addMethod(
  8225. "__eq",
  8226. smalltalk.method({
  8227. selector: "=",
  8228. category: 'comparing',
  8229. fn: function (aHashedCollection){
  8230. var self=this;
  8231. var $1,$2,$3;
  8232. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aHashedCollection,"_class",[])]);
  8233. if(! smalltalk.assert($1)){
  8234. return false;
  8235. };
  8236. $2=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[smalltalk.send(aHashedCollection,"_size",[])]);
  8237. if(! smalltalk.assert($2)){
  8238. return false;
  8239. };
  8240. $3=smalltalk.send(smalltalk.send(self,"_associations",[]),"__eq",[smalltalk.send(aHashedCollection,"_associations",[])]);
  8241. return $3;
  8242. },
  8243. args: ["aHashedCollection"],
  8244. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  8245. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  8246. referencedClasses: []
  8247. }),
  8248. smalltalk.HashedCollection);
  8249. smalltalk.addMethod(
  8250. "_add_",
  8251. smalltalk.method({
  8252. selector: "add:",
  8253. category: 'adding/removing',
  8254. fn: function (anAssociation){
  8255. var self=this;
  8256. smalltalk.send(self,"_at_put_",[smalltalk.send(anAssociation,"_key",[]),smalltalk.send(anAssociation,"_value",[])]);
  8257. return self},
  8258. args: ["anAssociation"],
  8259. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8260. messageSends: ["at:put:", "key", "value"],
  8261. referencedClasses: []
  8262. }),
  8263. smalltalk.HashedCollection);
  8264. smalltalk.addMethod(
  8265. "_addAll_",
  8266. smalltalk.method({
  8267. selector: "addAll:",
  8268. category: 'adding/removing',
  8269. fn: function (aHashedCollection){
  8270. var self=this;
  8271. smalltalk.send(self,"_addAll_",[smalltalk.send(aHashedCollection,"_associations",[])],smalltalk.Collection);
  8272. return aHashedCollection;
  8273. },
  8274. args: ["aHashedCollection"],
  8275. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  8276. messageSends: ["addAll:", "associations"],
  8277. referencedClasses: []
  8278. }),
  8279. smalltalk.HashedCollection);
  8280. smalltalk.addMethod(
  8281. "_asDictionary",
  8282. smalltalk.method({
  8283. selector: "asDictionary",
  8284. category: 'converting',
  8285. fn: function (){
  8286. var self=this;
  8287. var $1;
  8288. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_fromPairs_",[smalltalk.send(self,"_associations",[])]);
  8289. return $1;
  8290. },
  8291. args: [],
  8292. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  8293. messageSends: ["fromPairs:", "associations"],
  8294. referencedClasses: ["Dictionary"]
  8295. }),
  8296. smalltalk.HashedCollection);
  8297. smalltalk.addMethod(
  8298. "_asJSON",
  8299. smalltalk.method({
  8300. selector: "asJSON",
  8301. category: 'converting',
  8302. fn: function (){
  8303. var self=this;
  8304. var c;
  8305. c=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8306. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8307. return smalltalk.send(c,"_at_put_",[key,smalltalk.send(value,"_asJSON",[])]);
  8308. })]);
  8309. return c;
  8310. },
  8311. args: [],
  8312. 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",
  8313. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  8314. referencedClasses: []
  8315. }),
  8316. smalltalk.HashedCollection);
  8317. smalltalk.addMethod(
  8318. "_associations",
  8319. smalltalk.method({
  8320. selector: "associations",
  8321. category: 'accessing',
  8322. fn: function (){
  8323. var self=this;
  8324. var associations;
  8325. associations=[];
  8326. smalltalk.send(smalltalk.send(self,"_keys",[]),"_do_",[(function(each){
  8327. return smalltalk.send(associations,"_add_",[smalltalk.send((smalltalk.Association || Association),"_key_value_",[each,smalltalk.send(self,"_at_",[each])])]);
  8328. })]);
  8329. return associations;
  8330. },
  8331. args: [],
  8332. 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",
  8333. messageSends: ["do:", "add:", "key:value:", "at:", "keys"],
  8334. referencedClasses: ["Association"]
  8335. }),
  8336. smalltalk.HashedCollection);
  8337. smalltalk.addMethod(
  8338. "_associationsDo_",
  8339. smalltalk.method({
  8340. selector: "associationsDo:",
  8341. category: 'enumerating',
  8342. fn: function (aBlock){
  8343. var self=this;
  8344. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_",[aBlock]);
  8345. return self},
  8346. args: ["aBlock"],
  8347. source: "associationsDo: aBlock\x0a\x09self associations do: aBlock",
  8348. messageSends: ["do:", "associations"],
  8349. referencedClasses: []
  8350. }),
  8351. smalltalk.HashedCollection);
  8352. smalltalk.addMethod(
  8353. "_at_",
  8354. smalltalk.method({
  8355. selector: "at:",
  8356. category: 'accessing',
  8357. fn: function (aKey){
  8358. var self=this;
  8359. var $1;
  8360. $1=smalltalk.send(self,"_at_ifAbsent_",[aKey,(function(){
  8361. return smalltalk.send(self,"_errorNotFound",[]);
  8362. })]);
  8363. return $1;
  8364. },
  8365. args: ["aKey"],
  8366. source: "at: aKey\x0a\x09^self at: aKey ifAbsent: [self errorNotFound]",
  8367. messageSends: ["at:ifAbsent:", "errorNotFound"],
  8368. referencedClasses: []
  8369. }),
  8370. smalltalk.HashedCollection);
  8371. smalltalk.addMethod(
  8372. "_at_ifAbsent_",
  8373. smalltalk.method({
  8374. selector: "at:ifAbsent:",
  8375. category: 'accessing',
  8376. fn: function (aKey,aBlock){
  8377. var self=this;
  8378. var $2,$1;
  8379. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8380. $1=smalltalk.send($2,"_ifTrue_ifFalse_",[(function(){
  8381. return smalltalk.send(self,"_basicAt_",[aKey]);
  8382. }),aBlock]);
  8383. return $1;
  8384. },
  8385. args: ["aKey", "aBlock"],
  8386. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  8387. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  8388. referencedClasses: []
  8389. }),
  8390. smalltalk.HashedCollection);
  8391. smalltalk.addMethod(
  8392. "_at_ifAbsentPut_",
  8393. smalltalk.method({
  8394. selector: "at:ifAbsentPut:",
  8395. category: 'accessing',
  8396. fn: function (aKey,aBlock){
  8397. var self=this;
  8398. var $1;
  8399. $1=smalltalk.send(self,"_at_ifAbsent_",[aKey,(function(){
  8400. return smalltalk.send(self,"_at_put_",[aKey,smalltalk.send(aBlock,"_value",[])]);
  8401. })]);
  8402. return $1;
  8403. },
  8404. args: ["aKey", "aBlock"],
  8405. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09 self at: aKey put: aBlock value]",
  8406. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  8407. referencedClasses: []
  8408. }),
  8409. smalltalk.HashedCollection);
  8410. smalltalk.addMethod(
  8411. "_at_ifPresent_",
  8412. smalltalk.method({
  8413. selector: "at:ifPresent:",
  8414. category: 'accessing',
  8415. fn: function (aKey,aBlock){
  8416. var self=this;
  8417. var $2,$1;
  8418. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8419. if(smalltalk.assert($2)){
  8420. $1=smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_at_",[aKey])]);
  8421. } else {
  8422. $1=nil;
  8423. };
  8424. return $1;
  8425. },
  8426. args: ["aKey", "aBlock"],
  8427. source: "at: aKey ifPresent: aBlock\x0a\x09\x22Lookup the given key in the receiver. \x0a\x09If it is present, answer the value of evaluating the given block with the value associated with the key. \x0a\x09Otherwise, answer nil.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ nil ]",
  8428. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  8429. referencedClasses: []
  8430. }),
  8431. smalltalk.HashedCollection);
  8432. smalltalk.addMethod(
  8433. "_at_ifPresent_ifAbsent_",
  8434. smalltalk.method({
  8435. selector: "at:ifPresent:ifAbsent:",
  8436. category: 'accessing',
  8437. fn: function (aKey,aBlock,anotherBlock){
  8438. var self=this;
  8439. var $2,$1;
  8440. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8441. $1=smalltalk.send($2,"_ifTrue_ifFalse_",[(function(){
  8442. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_at_",[aKey])]);
  8443. }),anotherBlock]);
  8444. return $1;
  8445. },
  8446. args: ["aKey", "aBlock", "anotherBlock"],
  8447. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver. \x0a\x09If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key, \x0a\x09otherwise answer the value of absentBlock.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: anotherBlock",
  8448. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  8449. referencedClasses: []
  8450. }),
  8451. smalltalk.HashedCollection);
  8452. smalltalk.addMethod(
  8453. "_at_put_",
  8454. smalltalk.method({
  8455. selector: "at:put:",
  8456. category: 'accessing',
  8457. fn: function (aKey,aValue){
  8458. var self=this;
  8459. var $1;
  8460. $1=smalltalk.send(self,"_basicAt_put_",[aKey,aValue]);
  8461. return $1;
  8462. },
  8463. args: ["aKey", "aValue"],
  8464. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  8465. messageSends: ["basicAt:put:"],
  8466. referencedClasses: []
  8467. }),
  8468. smalltalk.HashedCollection);
  8469. smalltalk.addMethod(
  8470. "_collect_",
  8471. smalltalk.method({
  8472. selector: "collect:",
  8473. category: 'enumerating',
  8474. fn: function (aBlock){
  8475. var self=this;
  8476. var newDict;
  8477. newDict=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8478. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8479. return smalltalk.send(newDict,"_at_put_",[key,smalltalk.send(aBlock,"_value_",[value])]);
  8480. })]);
  8481. return newDict;
  8482. },
  8483. args: ["aBlock"],
  8484. 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",
  8485. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  8486. referencedClasses: []
  8487. }),
  8488. smalltalk.HashedCollection);
  8489. smalltalk.addMethod(
  8490. "_copyFrom_to_",
  8491. smalltalk.method({
  8492. selector: "copyFrom:to:",
  8493. category: 'copying',
  8494. fn: function (anIndex,anotherIndex){
  8495. var self=this;
  8496. smalltalk.send(self,"_shouldNotImplement",[]);
  8497. return self},
  8498. args: ["anIndex", "anotherIndex"],
  8499. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self shouldNotImplement",
  8500. messageSends: ["shouldNotImplement"],
  8501. referencedClasses: []
  8502. }),
  8503. smalltalk.HashedCollection);
  8504. smalltalk.addMethod(
  8505. "_deepCopy",
  8506. smalltalk.method({
  8507. selector: "deepCopy",
  8508. category: 'copying',
  8509. fn: function (){
  8510. var self=this;
  8511. var copy;
  8512. copy=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8513. smalltalk.send(self,"_associationsDo_",[(function(each){
  8514. return smalltalk.send(copy,"_at_put_",[smalltalk.send(each,"_key",[]),smalltalk.send(smalltalk.send(each,"_value",[]),"_deepCopy",[])]);
  8515. })]);
  8516. return copy;
  8517. },
  8518. args: [],
  8519. 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",
  8520. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "deepCopy", "value"],
  8521. referencedClasses: []
  8522. }),
  8523. smalltalk.HashedCollection);
  8524. smalltalk.addMethod(
  8525. "_detect_ifNone_",
  8526. smalltalk.method({
  8527. selector: "detect:ifNone:",
  8528. category: 'enumerating',
  8529. fn: function (aBlock,anotherBlock){
  8530. var self=this;
  8531. var $1;
  8532. $1=smalltalk.send(smalltalk.send(self,"_values",[]),"_detect_ifNone_",[aBlock,anotherBlock]);
  8533. return $1;
  8534. },
  8535. args: ["aBlock", "anotherBlock"],
  8536. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  8537. messageSends: ["detect:ifNone:", "values"],
  8538. referencedClasses: []
  8539. }),
  8540. smalltalk.HashedCollection);
  8541. smalltalk.addMethod(
  8542. "_do_",
  8543. smalltalk.method({
  8544. selector: "do:",
  8545. category: 'enumerating',
  8546. fn: function (aBlock){
  8547. var self=this;
  8548. smalltalk.send(smalltalk.send(self,"_values",[]),"_do_",[aBlock]);
  8549. return self},
  8550. args: ["aBlock"],
  8551. source: "do: aBlock\x0a\x09self values do: aBlock",
  8552. messageSends: ["do:", "values"],
  8553. referencedClasses: []
  8554. }),
  8555. smalltalk.HashedCollection);
  8556. smalltalk.addMethod(
  8557. "_includes_",
  8558. smalltalk.method({
  8559. selector: "includes:",
  8560. category: 'enumerating',
  8561. fn: function (anObject){
  8562. var self=this;
  8563. var $1;
  8564. $1=smalltalk.send(smalltalk.send(self,"_values",[]),"_includes_",[anObject]);
  8565. return $1;
  8566. },
  8567. args: ["anObject"],
  8568. source: "includes: anObject\x0a\x09^self values includes: anObject",
  8569. messageSends: ["includes:", "values"],
  8570. referencedClasses: []
  8571. }),
  8572. smalltalk.HashedCollection);
  8573. smalltalk.addMethod(
  8574. "_includesKey_",
  8575. smalltalk.method({
  8576. selector: "includesKey:",
  8577. category: 'testing',
  8578. fn: function (aKey){
  8579. var self=this;
  8580. return self.hasOwnProperty(aKey);
  8581. ;
  8582. return self},
  8583. args: ["aKey"],
  8584. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  8585. messageSends: [],
  8586. referencedClasses: []
  8587. }),
  8588. smalltalk.HashedCollection);
  8589. smalltalk.addMethod(
  8590. "_keys",
  8591. smalltalk.method({
  8592. selector: "keys",
  8593. category: 'accessing',
  8594. fn: function (){
  8595. var self=this;
  8596. if ('function'===typeof Object.keys) return Object.keys(self);
  8597. var keys = [];
  8598. for(var i in self) {
  8599. if(self.hasOwnProperty(i)) {
  8600. keys.push(i);
  8601. }
  8602. };
  8603. return keys;
  8604. ;
  8605. ;
  8606. return self},
  8607. args: [],
  8608. 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>",
  8609. messageSends: [],
  8610. referencedClasses: []
  8611. }),
  8612. smalltalk.HashedCollection);
  8613. smalltalk.addMethod(
  8614. "_keysAndValuesDo_",
  8615. smalltalk.method({
  8616. selector: "keysAndValuesDo:",
  8617. category: 'enumerating',
  8618. fn: function (aBlock){
  8619. var self=this;
  8620. smalltalk.send(self,"_associationsDo_",[(function(each){
  8621. return smalltalk.send(aBlock,"_value_value_",[smalltalk.send(each,"_key",[]),smalltalk.send(each,"_value",[])]);
  8622. })]);
  8623. return self},
  8624. args: ["aBlock"],
  8625. source: "keysAndValuesDo: aBlock\x0a\x09self associationsDo: [:each |\x0a\x09 aBlock value: each key value: each value]",
  8626. messageSends: ["associationsDo:", "value:value:", "key", "value"],
  8627. referencedClasses: []
  8628. }),
  8629. smalltalk.HashedCollection);
  8630. smalltalk.addMethod(
  8631. "_printString",
  8632. smalltalk.method({
  8633. selector: "printString",
  8634. category: 'printing',
  8635. fn: function (){
  8636. var self=this;
  8637. var $1;
  8638. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  8639. smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("a ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])]),"__comma",["("])]);
  8640. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_separatedBy_",[(function(each){
  8641. return smalltalk.send(each,"_storeOn_",[aStream]);
  8642. }),(function(){
  8643. return smalltalk.send(aStream,"_nextPutAll_",[" , "]);
  8644. })]);
  8645. return smalltalk.send(aStream,"_nextPutAll_",[")"]);
  8646. })]);
  8647. return $1;
  8648. },
  8649. args: [],
  8650. source: "printString\x0a\x09\x22print the contents of the HashedCollection into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream nextPutAll: 'a ', self class name, '('.\x0a\x09\x09self associations\x0a\x09\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' , '].\x0a\x09\x09aStream nextPutAll: ')']",
  8651. messageSends: ["streamContents:", "nextPutAll:", ",", "name", "class", "do:separatedBy:", "storeOn:", "associations"],
  8652. referencedClasses: ["String"]
  8653. }),
  8654. smalltalk.HashedCollection);
  8655. smalltalk.addMethod(
  8656. "_remove_ifAbsent_",
  8657. smalltalk.method({
  8658. selector: "remove:ifAbsent:",
  8659. category: 'adding/removing',
  8660. fn: function (aKey,aBlock){
  8661. var self=this;
  8662. var $1;
  8663. $1=smalltalk.send(self,"_removeKey_ifAbsent_",[aKey,aBlock]);
  8664. return $1;
  8665. },
  8666. args: ["aKey", "aBlock"],
  8667. source: "remove: aKey ifAbsent: aBlock\x0a ^self removeKey: aKey ifAbsent: aBlock",
  8668. messageSends: ["removeKey:ifAbsent:"],
  8669. referencedClasses: []
  8670. }),
  8671. smalltalk.HashedCollection);
  8672. smalltalk.addMethod(
  8673. "_removeKey_",
  8674. smalltalk.method({
  8675. selector: "removeKey:",
  8676. category: 'adding/removing',
  8677. fn: function (aKey){
  8678. var self=this;
  8679. var $1;
  8680. $1=smalltalk.send(self,"_remove_",[aKey]);
  8681. return $1;
  8682. },
  8683. args: ["aKey"],
  8684. source: "removeKey: aKey\x0a ^self remove: aKey",
  8685. messageSends: ["remove:"],
  8686. referencedClasses: []
  8687. }),
  8688. smalltalk.HashedCollection);
  8689. smalltalk.addMethod(
  8690. "_removeKey_ifAbsent_",
  8691. smalltalk.method({
  8692. selector: "removeKey:ifAbsent:",
  8693. category: 'adding/removing',
  8694. fn: function (aKey,aBlock){
  8695. var self=this;
  8696. var $2,$1;
  8697. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8698. if(smalltalk.assert($2)){
  8699. $1=smalltalk.send(self,"_basicDelete_",[aKey]);
  8700. } else {
  8701. $1=smalltalk.send(aBlock,"_value",[]);
  8702. };
  8703. return $1;
  8704. },
  8705. args: ["aKey", "aBlock"],
  8706. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey) \x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  8707. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  8708. referencedClasses: []
  8709. }),
  8710. smalltalk.HashedCollection);
  8711. smalltalk.addMethod(
  8712. "_select_",
  8713. smalltalk.method({
  8714. selector: "select:",
  8715. category: 'enumerating',
  8716. fn: function (aBlock){
  8717. var self=this;
  8718. var $1;
  8719. var newDict;
  8720. newDict=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8721. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8722. $1=smalltalk.send(aBlock,"_value_",[value]);
  8723. if(smalltalk.assert($1)){
  8724. return smalltalk.send(newDict,"_at_put_",[key,value]);
  8725. };
  8726. })]);
  8727. return newDict;
  8728. },
  8729. args: ["aBlock"],
  8730. 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",
  8731. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  8732. referencedClasses: []
  8733. }),
  8734. smalltalk.HashedCollection);
  8735. smalltalk.addMethod(
  8736. "_shallowCopy",
  8737. smalltalk.method({
  8738. selector: "shallowCopy",
  8739. category: 'copying',
  8740. fn: function (){
  8741. var self=this;
  8742. var copy;
  8743. copy=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8744. smalltalk.send(self,"_associationsDo_",[(function(each){
  8745. return smalltalk.send(copy,"_at_put_",[smalltalk.send(each,"_key",[]),smalltalk.send(each,"_value",[])]);
  8746. })]);
  8747. return copy;
  8748. },
  8749. args: [],
  8750. 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",
  8751. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "value"],
  8752. referencedClasses: []
  8753. }),
  8754. smalltalk.HashedCollection);
  8755. smalltalk.addMethod(
  8756. "_size",
  8757. smalltalk.method({
  8758. selector: "size",
  8759. category: 'accessing',
  8760. fn: function (){
  8761. var self=this;
  8762. var $1;
  8763. $1=smalltalk.send(smalltalk.send(self,"_keys",[]),"_size",[]);
  8764. return $1;
  8765. },
  8766. args: [],
  8767. source: "size\x0a\x09^self keys size",
  8768. messageSends: ["size", "keys"],
  8769. referencedClasses: []
  8770. }),
  8771. smalltalk.HashedCollection);
  8772. smalltalk.addMethod(
  8773. "_storeOn_",
  8774. smalltalk.method({
  8775. selector: "storeOn:",
  8776. category: 'printing',
  8777. fn: function (aStream){
  8778. var self=this;
  8779. smalltalk.send(aStream,"_nextPutAll_",["#{"]);
  8780. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_separatedBy_",[(function(each){
  8781. return smalltalk.send(each,"_storeOn_",[aStream]);
  8782. }),(function(){
  8783. return smalltalk.send(aStream,"_nextPutAll_",[". "]);
  8784. })]);
  8785. smalltalk.send(aStream,"_nextPutAll_",["}"]);
  8786. return self},
  8787. args: ["aStream"],
  8788. source: "storeOn: aStream\x0a\x09aStream nextPutAll: '#{'.\x0a\x09self associations\x0a\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09separatedBy: [ aStream nextPutAll: '. '].\x0a\x09aStream nextPutAll: '}'",
  8789. messageSends: ["nextPutAll:", "do:separatedBy:", "storeOn:", "associations"],
  8790. referencedClasses: []
  8791. }),
  8792. smalltalk.HashedCollection);
  8793. smalltalk.addMethod(
  8794. "_values",
  8795. smalltalk.method({
  8796. selector: "values",
  8797. category: 'accessing',
  8798. fn: function (){
  8799. var self=this;
  8800. var $1;
  8801. $1=smalltalk.send(smalltalk.send(self,"_keys",[]),"_collect_",[(function(each){
  8802. return smalltalk.send(self,"_at_",[each]);
  8803. })]);
  8804. return $1;
  8805. },
  8806. args: [],
  8807. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  8808. messageSends: ["collect:", "at:", "keys"],
  8809. referencedClasses: []
  8810. }),
  8811. smalltalk.HashedCollection);
  8812. smalltalk.addMethod(
  8813. "_fromPairs_",
  8814. smalltalk.method({
  8815. selector: "fromPairs:",
  8816. category: 'instance creation',
  8817. fn: function (aCollection){
  8818. var self=this;
  8819. var dict;
  8820. dict=smalltalk.send(self,"_new",[]);
  8821. smalltalk.send(aCollection,"_do_",[(function(each){
  8822. return smalltalk.send(dict,"_add_",[each]);
  8823. })]);
  8824. return dict;
  8825. },
  8826. args: ["aCollection"],
  8827. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  8828. messageSends: ["new", "do:", "add:"],
  8829. referencedClasses: []
  8830. }),
  8831. smalltalk.HashedCollection.klass);
  8832. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  8833. smalltalk.addMethod(
  8834. "_asHashedCollection",
  8835. smalltalk.method({
  8836. selector: "asHashedCollection",
  8837. category: 'converting',
  8838. fn: function (){
  8839. var self=this;
  8840. var $1;
  8841. $1=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_fromPairs_",[smalltalk.send(self,"_associations",[])]);
  8842. return $1;
  8843. },
  8844. args: [],
  8845. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  8846. messageSends: ["fromPairs:", "associations"],
  8847. referencedClasses: ["HashedCollection"]
  8848. }),
  8849. smalltalk.Dictionary);
  8850. smalltalk.addMethod(
  8851. "_asJSON",
  8852. smalltalk.method({
  8853. selector: "asJSON",
  8854. category: 'converting',
  8855. fn: function (){
  8856. var self=this;
  8857. var $1;
  8858. $1=smalltalk.send(smalltalk.send(self,"_asHashedCollection",[]),"_asJSON",[]);
  8859. return $1;
  8860. },
  8861. args: [],
  8862. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  8863. messageSends: ["asJSON", "asHashedCollection"],
  8864. referencedClasses: []
  8865. }),
  8866. smalltalk.Dictionary);
  8867. smalltalk.addMethod(
  8868. "_at_ifAbsent_",
  8869. smalltalk.method({
  8870. selector: "at:ifAbsent:",
  8871. category: 'accessing',
  8872. fn: function (aKey,aBlock){
  8873. var self=this;
  8874. var index;
  8875. for(var i=0;i<self['@keys'].length;i++){
  8876. if(self['@keys'][i].__eq(aKey)) {index = i;}
  8877. };
  8878. if(typeof index === 'undefined') {
  8879. return aBlock();
  8880. } else {
  8881. return self['@values'][index];
  8882. }
  8883. ;
  8884. ;
  8885. return self},
  8886. args: ["aKey", "aBlock"],
  8887. 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>",
  8888. messageSends: [],
  8889. referencedClasses: []
  8890. }),
  8891. smalltalk.Dictionary);
  8892. smalltalk.addMethod(
  8893. "_at_put_",
  8894. smalltalk.method({
  8895. selector: "at:put:",
  8896. category: 'accessing',
  8897. fn: function (aKey,aValue){
  8898. var self=this;
  8899. var index = self['@keys'].indexOf(aKey);
  8900. if(index === -1) {
  8901. self['@values'].push(aValue);
  8902. self['@keys'].push(aKey);
  8903. } else {
  8904. self['@values'][index] = aValue;
  8905. };
  8906. return aValue;
  8907. ;
  8908. ;
  8909. return self},
  8910. args: ["aKey", "aValue"],
  8911. 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>",
  8912. messageSends: [],
  8913. referencedClasses: []
  8914. }),
  8915. smalltalk.Dictionary);
  8916. smalltalk.addMethod(
  8917. "_includesKey_",
  8918. smalltalk.method({
  8919. selector: "includesKey:",
  8920. category: 'testing',
  8921. fn: function (aKey){
  8922. var self=this;
  8923. var $1;
  8924. $1=smalltalk.send(self["@keys"],"_includes_",[aKey]);
  8925. return $1;
  8926. },
  8927. args: ["aKey"],
  8928. source: "includesKey: aKey\x0a\x09^keys includes: aKey",
  8929. messageSends: ["includes:"],
  8930. referencedClasses: []
  8931. }),
  8932. smalltalk.Dictionary);
  8933. smalltalk.addMethod(
  8934. "_initialize",
  8935. smalltalk.method({
  8936. selector: "initialize",
  8937. category: 'initialization',
  8938. fn: function (){
  8939. var self=this;
  8940. smalltalk.send(self,"_initialize",[],smalltalk.HashedCollection);
  8941. self["@keys"]=[];
  8942. self["@values"]=[];
  8943. return self},
  8944. args: [],
  8945. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  8946. messageSends: ["initialize"],
  8947. referencedClasses: []
  8948. }),
  8949. smalltalk.Dictionary);
  8950. smalltalk.addMethod(
  8951. "_keyAtValue_",
  8952. smalltalk.method({
  8953. selector: "keyAtValue:",
  8954. category: 'accessing',
  8955. fn: function (anObject){
  8956. var self=this;
  8957. var $1;
  8958. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_associations",[]),"_detect_ifNone_",[(function(k,v){
  8959. return smalltalk.send(v,"__eq_eq",[anObject]);
  8960. }),(function(){
  8961. return smalltalk.send(self,"_error_",["Not found"]);
  8962. })]),"_key",[]);
  8963. return $1;
  8964. },
  8965. args: ["anObject"],
  8966. source: "keyAtValue: anObject\x0a\x0a\x09^ (self associations \x0a \x09detect:[:k :v| v == anObject] \x0a \x09ifNone:[self error: 'Not found']) key",
  8967. messageSends: ["key", "detect:ifNone:", "==", "error:", "associations"],
  8968. referencedClasses: []
  8969. }),
  8970. smalltalk.Dictionary);
  8971. smalltalk.addMethod(
  8972. "_keys",
  8973. smalltalk.method({
  8974. selector: "keys",
  8975. category: 'accessing',
  8976. fn: function (){
  8977. var self=this;
  8978. var $1;
  8979. $1=smalltalk.send(self["@keys"],"_copy",[]);
  8980. return $1;
  8981. },
  8982. args: [],
  8983. source: "keys\x0a\x09^keys copy",
  8984. messageSends: ["copy"],
  8985. referencedClasses: []
  8986. }),
  8987. smalltalk.Dictionary);
  8988. smalltalk.addMethod(
  8989. "_removeKey_ifAbsent_",
  8990. smalltalk.method({
  8991. selector: "removeKey:ifAbsent:",
  8992. category: 'adding/removing',
  8993. fn: function (aKey,aBlock){
  8994. var self=this;
  8995. var index = self['@keys'].indexOf(aKey);
  8996. if(index === -1) {
  8997. return aBlock()
  8998. } else {
  8999. var value;
  9000. self['@keys'].splice(index, 1);
  9001. value = self['@values'].splice(index, 1);
  9002. return value[0];
  9003. };
  9004. ;
  9005. ;
  9006. return self},
  9007. args: ["aKey", "aBlock"],
  9008. 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 >",
  9009. messageSends: [],
  9010. referencedClasses: []
  9011. }),
  9012. smalltalk.Dictionary);
  9013. smalltalk.addMethod(
  9014. "_valueAt_",
  9015. smalltalk.method({
  9016. selector: "valueAt:",
  9017. category: 'accessing',
  9018. fn: function (anObject){
  9019. var self=this;
  9020. var $1;
  9021. $1=smalltalk.send(self,"_associationsDo_",[(2)]);
  9022. return $1;
  9023. },
  9024. args: ["anObject"],
  9025. source: "valueAt: anObject\x0a\x0a\x09^ self associationsDo:2",
  9026. messageSends: ["associationsDo:"],
  9027. referencedClasses: []
  9028. }),
  9029. smalltalk.Dictionary);
  9030. smalltalk.addMethod(
  9031. "_values",
  9032. smalltalk.method({
  9033. selector: "values",
  9034. category: 'accessing',
  9035. fn: function (){
  9036. var self=this;
  9037. var $1;
  9038. $1=smalltalk.send(self["@values"],"_copy",[]);
  9039. return $1;
  9040. },
  9041. args: [],
  9042. source: "values\x0a\x09^values copy",
  9043. messageSends: ["copy"],
  9044. referencedClasses: []
  9045. }),
  9046. smalltalk.Dictionary);
  9047. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  9048. smalltalk.addMethod(
  9049. "__eq",
  9050. smalltalk.method({
  9051. selector: "=",
  9052. category: 'comparing',
  9053. fn: function (aCollection){
  9054. var self=this;
  9055. var $1,$2;
  9056. var $early={};
  9057. try {
  9058. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  9059. return smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[smalltalk.send(aCollection,"_size",[])]);
  9060. })]);
  9061. if(! smalltalk.assert($1)){
  9062. return false;
  9063. };
  9064. smalltalk.send(self,"_withIndexDo_",[(function(each,i){
  9065. $2=smalltalk.send(smalltalk.send(aCollection,"_at_",[i]),"__eq",[each]);
  9066. if(! smalltalk.assert($2)){
  9067. throw $early=[false];
  9068. };
  9069. })]);
  9070. return true;
  9071. }
  9072. catch(e) {if(e===$early)return e[0]; throw e}
  9073. },
  9074. args: ["aCollection"],
  9075. 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",
  9076. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  9077. referencedClasses: []
  9078. }),
  9079. smalltalk.SequenceableCollection);
  9080. smalltalk.addMethod(
  9081. "_addLast_",
  9082. smalltalk.method({
  9083. selector: "addLast:",
  9084. category: 'adding',
  9085. fn: function (anObject){
  9086. var self=this;
  9087. smalltalk.send(self,"_add_",[anObject]);
  9088. return self},
  9089. args: ["anObject"],
  9090. source: "addLast: anObject\x0a\x09self add: anObject",
  9091. messageSends: ["add:"],
  9092. referencedClasses: []
  9093. }),
  9094. smalltalk.SequenceableCollection);
  9095. smalltalk.addMethod(
  9096. "_allButFirst",
  9097. smalltalk.method({
  9098. selector: "allButFirst",
  9099. category: 'accessing',
  9100. fn: function (){
  9101. var self=this;
  9102. var $1;
  9103. $1=smalltalk.send(self,"_copyFrom_to_",[(2),smalltalk.send(self,"_size",[])]);
  9104. return $1;
  9105. },
  9106. args: [],
  9107. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  9108. messageSends: ["copyFrom:to:", "size"],
  9109. referencedClasses: []
  9110. }),
  9111. smalltalk.SequenceableCollection);
  9112. smalltalk.addMethod(
  9113. "_allButLast",
  9114. smalltalk.method({
  9115. selector: "allButLast",
  9116. category: 'accessing',
  9117. fn: function (){
  9118. var self=this;
  9119. var $1;
  9120. $1=smalltalk.send(self,"_copyFrom_to_",[(1),smalltalk.send(smalltalk.send(self,"_size",[]),"__minus",[(1)])]);
  9121. return $1;
  9122. },
  9123. args: [],
  9124. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  9125. messageSends: ["copyFrom:to:", "-", "size"],
  9126. referencedClasses: []
  9127. }),
  9128. smalltalk.SequenceableCollection);
  9129. smalltalk.addMethod(
  9130. "_at_",
  9131. smalltalk.method({
  9132. selector: "at:",
  9133. category: 'accessing',
  9134. fn: function (anIndex){
  9135. var self=this;
  9136. var $1;
  9137. $1=smalltalk.send(self,"_at_ifAbsent_",[anIndex,(function(){
  9138. return smalltalk.send(self,"_errorNotFound",[]);
  9139. })]);
  9140. return $1;
  9141. },
  9142. args: ["anIndex"],
  9143. source: "at: anIndex\x0a\x09^self at: anIndex ifAbsent: [\x0a\x09 self errorNotFound]",
  9144. messageSends: ["at:ifAbsent:", "errorNotFound"],
  9145. referencedClasses: []
  9146. }),
  9147. smalltalk.SequenceableCollection);
  9148. smalltalk.addMethod(
  9149. "_at_ifAbsent_",
  9150. smalltalk.method({
  9151. selector: "at:ifAbsent:",
  9152. category: 'accessing',
  9153. fn: function (anIndex,aBlock){
  9154. var self=this;
  9155. smalltalk.send(self,"_subclassResponsibility",[]);
  9156. return self},
  9157. args: ["anIndex", "aBlock"],
  9158. source: "at: anIndex ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9159. messageSends: ["subclassResponsibility"],
  9160. referencedClasses: []
  9161. }),
  9162. smalltalk.SequenceableCollection);
  9163. smalltalk.addMethod(
  9164. "_at_put_",
  9165. smalltalk.method({
  9166. selector: "at:put:",
  9167. category: 'accessing',
  9168. fn: function (anIndex,anObject){
  9169. var self=this;
  9170. smalltalk.send(self,"_subclassResponsibility",[]);
  9171. return self},
  9172. args: ["anIndex", "anObject"],
  9173. source: "at: anIndex put: anObject\x0a\x09self subclassResponsibility",
  9174. messageSends: ["subclassResponsibility"],
  9175. referencedClasses: []
  9176. }),
  9177. smalltalk.SequenceableCollection);
  9178. smalltalk.addMethod(
  9179. "_atRandom",
  9180. smalltalk.method({
  9181. selector: "atRandom",
  9182. category: 'accessing',
  9183. fn: function (){
  9184. var self=this;
  9185. var $1;
  9186. $1=smalltalk.send(self,"_at_",[smalltalk.send(smalltalk.send(self,"_size",[]),"_atRandom",[])]);
  9187. return $1;
  9188. },
  9189. args: [],
  9190. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9191. messageSends: ["at:", "atRandom", "size"],
  9192. referencedClasses: []
  9193. }),
  9194. smalltalk.SequenceableCollection);
  9195. smalltalk.addMethod(
  9196. "_copyFrom_to_",
  9197. smalltalk.method({
  9198. selector: "copyFrom:to:",
  9199. category: 'copying',
  9200. fn: function (anIndex,anotherIndex){
  9201. var self=this;
  9202. var range;
  9203. var newCollection;
  9204. range=smalltalk.send(anIndex,"_to_",[anotherIndex]);
  9205. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(range,"_size",[])]);
  9206. smalltalk.send(range,"_withIndexDo_",[(function(each,i){
  9207. return smalltalk.send(newCollection,"_at_put_",[i,smalltalk.send(self,"_at_",[each])]);
  9208. })]);
  9209. return newCollection;
  9210. },
  9211. args: ["anIndex", "anotherIndex"],
  9212. 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",
  9213. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  9214. referencedClasses: []
  9215. }),
  9216. smalltalk.SequenceableCollection);
  9217. smalltalk.addMethod(
  9218. "_deepCopy",
  9219. smalltalk.method({
  9220. selector: "deepCopy",
  9221. category: 'copying',
  9222. fn: function (){
  9223. var self=this;
  9224. var newCollection;
  9225. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  9226. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  9227. return smalltalk.send(newCollection,"_at_put_",[index,smalltalk.send(each,"_deepCopy",[])]);
  9228. })]);
  9229. return newCollection;
  9230. },
  9231. args: [],
  9232. 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",
  9233. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  9234. referencedClasses: []
  9235. }),
  9236. smalltalk.SequenceableCollection);
  9237. smalltalk.addMethod(
  9238. "_first",
  9239. smalltalk.method({
  9240. selector: "first",
  9241. category: 'accessing',
  9242. fn: function (){
  9243. var self=this;
  9244. var $1;
  9245. $1=smalltalk.send(self,"_at_",[(1)]);
  9246. return $1;
  9247. },
  9248. args: [],
  9249. source: "first\x0a\x09^self at: 1",
  9250. messageSends: ["at:"],
  9251. referencedClasses: []
  9252. }),
  9253. smalltalk.SequenceableCollection);
  9254. smalltalk.addMethod(
  9255. "_first_",
  9256. smalltalk.method({
  9257. selector: "first:",
  9258. category: 'accessing',
  9259. fn: function (n){
  9260. var self=this;
  9261. var $1;
  9262. $1=smalltalk.send(self,"_copyFrom_to_",[(1),n]);
  9263. return $1;
  9264. },
  9265. args: ["n"],
  9266. 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",
  9267. messageSends: ["copyFrom:to:"],
  9268. referencedClasses: []
  9269. }),
  9270. smalltalk.SequenceableCollection);
  9271. smalltalk.addMethod(
  9272. "_fourth",
  9273. smalltalk.method({
  9274. selector: "fourth",
  9275. category: 'accessing',
  9276. fn: function (){
  9277. var self=this;
  9278. var $1;
  9279. $1=smalltalk.send(self,"_at_",[(4)]);
  9280. return $1;
  9281. },
  9282. args: [],
  9283. source: "fourth\x0a\x09^self at: 4",
  9284. messageSends: ["at:"],
  9285. referencedClasses: []
  9286. }),
  9287. smalltalk.SequenceableCollection);
  9288. smalltalk.addMethod(
  9289. "_indexOf_",
  9290. smalltalk.method({
  9291. selector: "indexOf:",
  9292. category: 'accessing',
  9293. fn: function (anObject){
  9294. var self=this;
  9295. var $1;
  9296. $1=smalltalk.send(self,"_indexOf_ifAbsent_",[anObject,(function(){
  9297. return smalltalk.send(self,"_errorNotFound",[]);
  9298. })]);
  9299. return $1;
  9300. },
  9301. args: ["anObject"],
  9302. source: "indexOf: anObject\x0a\x09^self indexOf: anObject ifAbsent: [self errorNotFound]",
  9303. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  9304. referencedClasses: []
  9305. }),
  9306. smalltalk.SequenceableCollection);
  9307. smalltalk.addMethod(
  9308. "_indexOf_ifAbsent_",
  9309. smalltalk.method({
  9310. selector: "indexOf:ifAbsent:",
  9311. category: 'accessing',
  9312. fn: function (anObject,aBlock){
  9313. var self=this;
  9314. for(var i=0;i<self.length;i++) {
  9315. if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}
  9316. };
  9317. return aBlock();
  9318. ;
  9319. ;
  9320. return self},
  9321. args: ["anObject", "aBlock"],
  9322. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock();\x0a\x09>",
  9323. messageSends: [],
  9324. referencedClasses: []
  9325. }),
  9326. smalltalk.SequenceableCollection);
  9327. smalltalk.addMethod(
  9328. "_indexOf_startingAt_",
  9329. smalltalk.method({
  9330. selector: "indexOf:startingAt:",
  9331. category: 'accessing',
  9332. fn: function (anObject,start){
  9333. var self=this;
  9334. var $1;
  9335. $1=smalltalk.send(self,"_indexOf_startingAt_ifAbsent_",[anObject,start,(function(){
  9336. return (0);
  9337. })]);
  9338. return $1;
  9339. },
  9340. args: ["anObject", "start"],
  9341. 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]",
  9342. messageSends: ["indexOf:startingAt:ifAbsent:"],
  9343. referencedClasses: []
  9344. }),
  9345. smalltalk.SequenceableCollection);
  9346. smalltalk.addMethod(
  9347. "_indexOf_startingAt_ifAbsent_",
  9348. smalltalk.method({
  9349. selector: "indexOf:startingAt:ifAbsent:",
  9350. category: 'accessing',
  9351. fn: function (anObject,start,aBlock){
  9352. var self=this;
  9353. for(var i=start-1;i<self.length;i++){
  9354. if(self[i].__eq(anObject)) {return i+1}
  9355. }
  9356. return aBlock();
  9357. ;
  9358. ;
  9359. return self},
  9360. args: ["anObject", "start", "aBlock"],
  9361. 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>",
  9362. messageSends: [],
  9363. referencedClasses: []
  9364. }),
  9365. smalltalk.SequenceableCollection);
  9366. smalltalk.addMethod(
  9367. "_last",
  9368. smalltalk.method({
  9369. selector: "last",
  9370. category: 'accessing',
  9371. fn: function (){
  9372. var self=this;
  9373. var $1;
  9374. $1=smalltalk.send(self,"_at_",[smalltalk.send(self,"_size",[])]);
  9375. return $1;
  9376. },
  9377. args: [],
  9378. source: "last\x0a\x09^self at: self size",
  9379. messageSends: ["at:", "size"],
  9380. referencedClasses: []
  9381. }),
  9382. smalltalk.SequenceableCollection);
  9383. smalltalk.addMethod(
  9384. "_removeLast",
  9385. smalltalk.method({
  9386. selector: "removeLast",
  9387. category: 'adding',
  9388. fn: function (){
  9389. var self=this;
  9390. smalltalk.send(self,"_remove_",[smalltalk.send(self,"_last",[])]);
  9391. return self},
  9392. args: [],
  9393. source: "removeLast\x0a\x09self remove: self last",
  9394. messageSends: ["remove:", "last"],
  9395. referencedClasses: []
  9396. }),
  9397. smalltalk.SequenceableCollection);
  9398. smalltalk.addMethod(
  9399. "_reversed",
  9400. smalltalk.method({
  9401. selector: "reversed",
  9402. category: 'converting',
  9403. fn: function (){
  9404. var self=this;
  9405. smalltalk.send(self,"_subclassResponsibility",[]);
  9406. return self},
  9407. args: [],
  9408. source: "reversed\x0a\x09self subclassResponsibility",
  9409. messageSends: ["subclassResponsibility"],
  9410. referencedClasses: []
  9411. }),
  9412. smalltalk.SequenceableCollection);
  9413. smalltalk.addMethod(
  9414. "_second",
  9415. smalltalk.method({
  9416. selector: "second",
  9417. category: 'accessing',
  9418. fn: function (){
  9419. var self=this;
  9420. var $1;
  9421. $1=smalltalk.send(self,"_at_",[(2)]);
  9422. return $1;
  9423. },
  9424. args: [],
  9425. source: "second\x0a\x09^self at: 2",
  9426. messageSends: ["at:"],
  9427. referencedClasses: []
  9428. }),
  9429. smalltalk.SequenceableCollection);
  9430. smalltalk.addMethod(
  9431. "_shallowCopy",
  9432. smalltalk.method({
  9433. selector: "shallowCopy",
  9434. category: 'copying',
  9435. fn: function (){
  9436. var self=this;
  9437. var newCollection;
  9438. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  9439. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  9440. return smalltalk.send(newCollection,"_at_put_",[index,each]);
  9441. })]);
  9442. return newCollection;
  9443. },
  9444. args: [],
  9445. 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",
  9446. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  9447. referencedClasses: []
  9448. }),
  9449. smalltalk.SequenceableCollection);
  9450. smalltalk.addMethod(
  9451. "_third",
  9452. smalltalk.method({
  9453. selector: "third",
  9454. category: 'accessing',
  9455. fn: function (){
  9456. var self=this;
  9457. var $1;
  9458. $1=smalltalk.send(self,"_at_",[(3)]);
  9459. return $1;
  9460. },
  9461. args: [],
  9462. source: "third\x0a\x09^self at: 3",
  9463. messageSends: ["at:"],
  9464. referencedClasses: []
  9465. }),
  9466. smalltalk.SequenceableCollection);
  9467. smalltalk.addMethod(
  9468. "_withIndexDo_",
  9469. smalltalk.method({
  9470. selector: "withIndexDo:",
  9471. category: 'enumerating',
  9472. fn: function (aBlock){
  9473. var self=this;
  9474. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  9475. ;
  9476. return self},
  9477. args: ["aBlock"],
  9478. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  9479. messageSends: [],
  9480. referencedClasses: []
  9481. }),
  9482. smalltalk.SequenceableCollection);
  9483. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  9484. smalltalk.addMethod(
  9485. "_add_",
  9486. smalltalk.method({
  9487. selector: "add:",
  9488. category: 'adding/removing',
  9489. fn: function (anObject){
  9490. var self=this;
  9491. self.push(anObject); return anObject;;
  9492. ;
  9493. return self},
  9494. args: ["anObject"],
  9495. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  9496. messageSends: [],
  9497. referencedClasses: []
  9498. }),
  9499. smalltalk.Array);
  9500. smalltalk.addMethod(
  9501. "_asJavascript",
  9502. smalltalk.method({
  9503. selector: "asJavascript",
  9504. category: 'converting',
  9505. fn: function (){
  9506. var self=this;
  9507. var $1;
  9508. $1=smalltalk.send(smalltalk.send("[","__comma",[smalltalk.send(smalltalk.send(self,"_collect_",[(function(each){
  9509. return smalltalk.send(each,"_asJavascript",[]);
  9510. })]),"_join_",[", "])]),"__comma",["]"]);
  9511. return $1;
  9512. },
  9513. args: [],
  9514. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  9515. messageSends: [",", "join:", "collect:", "asJavascript"],
  9516. referencedClasses: []
  9517. }),
  9518. smalltalk.Array);
  9519. smalltalk.addMethod(
  9520. "_at_ifAbsent_",
  9521. smalltalk.method({
  9522. selector: "at:ifAbsent:",
  9523. category: 'accessing',
  9524. fn: function (anIndex,aBlock){
  9525. var self=this;
  9526. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  9527. return self[anIndex - 1];
  9528. ;
  9529. ;
  9530. return self},
  9531. args: ["anIndex", "aBlock"],
  9532. 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>",
  9533. messageSends: [],
  9534. referencedClasses: []
  9535. }),
  9536. smalltalk.Array);
  9537. smalltalk.addMethod(
  9538. "_at_put_",
  9539. smalltalk.method({
  9540. selector: "at:put:",
  9541. category: 'accessing',
  9542. fn: function (anIndex,anObject){
  9543. var self=this;
  9544. return self[anIndex - 1] = anObject;
  9545. ;
  9546. return self},
  9547. args: ["anIndex", "anObject"],
  9548. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  9549. messageSends: [],
  9550. referencedClasses: []
  9551. }),
  9552. smalltalk.Array);
  9553. smalltalk.addMethod(
  9554. "_join_",
  9555. smalltalk.method({
  9556. selector: "join:",
  9557. category: 'enumerating',
  9558. fn: function (aString){
  9559. var self=this;
  9560. return self.join(aString);
  9561. ;
  9562. return self},
  9563. args: ["aString"],
  9564. source: "join: aString\x0a\x09<return self.join(aString)>",
  9565. messageSends: [],
  9566. referencedClasses: []
  9567. }),
  9568. smalltalk.Array);
  9569. smalltalk.addMethod(
  9570. "_remove_ifAbsent_",
  9571. smalltalk.method({
  9572. selector: "remove:ifAbsent:",
  9573. category: 'adding/removing',
  9574. fn: function (anObject,aBlock){
  9575. var self=this;
  9576. for(var i=0;i<self.length;i++) {
  9577. if(self[i] == anObject) {
  9578. self.splice(i,1);
  9579. return self;
  9580. }
  9581. }
  9582. ;
  9583. ;
  9584. smalltalk.send(aBlock,"_value",[]);
  9585. return self},
  9586. args: ["anObject", "aBlock"],
  9587. source: "remove: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i] == anObject) {\x0a\x09\x09\x09\x09self.splice(i,1);\x0a\x09\x09\x09\x09return self;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09>.\x0a\x09aBlock value",
  9588. messageSends: ["value"],
  9589. referencedClasses: []
  9590. }),
  9591. smalltalk.Array);
  9592. smalltalk.addMethod(
  9593. "_removeFrom_to_",
  9594. smalltalk.method({
  9595. selector: "removeFrom:to:",
  9596. category: 'adding/removing',
  9597. fn: function (aNumber,anotherNumber){
  9598. var self=this;
  9599. self.splice(aNumber - 1,anotherNumber - 1);
  9600. ;
  9601. return self},
  9602. args: ["aNumber", "anotherNumber"],
  9603. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  9604. messageSends: [],
  9605. referencedClasses: []
  9606. }),
  9607. smalltalk.Array);
  9608. smalltalk.addMethod(
  9609. "_reversed",
  9610. smalltalk.method({
  9611. selector: "reversed",
  9612. category: 'converting',
  9613. fn: function (){
  9614. var self=this;
  9615. return self._copy().reverse();
  9616. ;
  9617. return self},
  9618. args: [],
  9619. source: "reversed\x0a\x09<return self._copy().reverse()>",
  9620. messageSends: [],
  9621. referencedClasses: []
  9622. }),
  9623. smalltalk.Array);
  9624. smalltalk.addMethod(
  9625. "_size",
  9626. smalltalk.method({
  9627. selector: "size",
  9628. category: 'accessing',
  9629. fn: function (){
  9630. var self=this;
  9631. return self.length;
  9632. ;
  9633. return self},
  9634. args: [],
  9635. source: "size\x0a\x09<return self.length>",
  9636. messageSends: [],
  9637. referencedClasses: []
  9638. }),
  9639. smalltalk.Array);
  9640. smalltalk.addMethod(
  9641. "_sort",
  9642. smalltalk.method({
  9643. selector: "sort",
  9644. category: 'enumerating',
  9645. fn: function (){
  9646. var self=this;
  9647. var $1;
  9648. $1=smalltalk.send(self,"_basicPerform_",["sort"]);
  9649. return $1;
  9650. },
  9651. args: [],
  9652. source: "sort\x0a ^self basicPerform: 'sort'",
  9653. messageSends: ["basicPerform:"],
  9654. referencedClasses: []
  9655. }),
  9656. smalltalk.Array);
  9657. smalltalk.addMethod(
  9658. "_sort_",
  9659. smalltalk.method({
  9660. selector: "sort:",
  9661. category: 'enumerating',
  9662. fn: function (aBlock){
  9663. var self=this;
  9664. return self.sort(function(a, b) {
  9665. if(aBlock(a,b)) {return -1} else {return 1}
  9666. })
  9667. ;
  9668. ;
  9669. return self},
  9670. args: ["aBlock"],
  9671. 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>",
  9672. messageSends: [],
  9673. referencedClasses: []
  9674. }),
  9675. smalltalk.Array);
  9676. smalltalk.addMethod(
  9677. "_sorted",
  9678. smalltalk.method({
  9679. selector: "sorted",
  9680. category: 'enumerating',
  9681. fn: function (){
  9682. var self=this;
  9683. var $1;
  9684. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort",[]);
  9685. return $1;
  9686. },
  9687. args: [],
  9688. source: "sorted\x0a\x09^self copy sort",
  9689. messageSends: ["sort", "copy"],
  9690. referencedClasses: []
  9691. }),
  9692. smalltalk.Array);
  9693. smalltalk.addMethod(
  9694. "_sorted_",
  9695. smalltalk.method({
  9696. selector: "sorted:",
  9697. category: 'enumerating',
  9698. fn: function (aBlock){
  9699. var self=this;
  9700. var $1;
  9701. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort_",[aBlock]);
  9702. return $1;
  9703. },
  9704. args: ["aBlock"],
  9705. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  9706. messageSends: ["sort:", "copy"],
  9707. referencedClasses: []
  9708. }),
  9709. smalltalk.Array);
  9710. smalltalk.addMethod(
  9711. "_new_",
  9712. smalltalk.method({
  9713. selector: "new:",
  9714. category: 'instance creation',
  9715. fn: function (anInteger){
  9716. var self=this;
  9717. return new Array(anInteger);
  9718. ;
  9719. return self},
  9720. args: ["anInteger"],
  9721. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  9722. messageSends: [],
  9723. referencedClasses: []
  9724. }),
  9725. smalltalk.Array.klass);
  9726. smalltalk.addMethod(
  9727. "_with_",
  9728. smalltalk.method({
  9729. selector: "with:",
  9730. category: 'instance creation',
  9731. fn: function (anObject){
  9732. var self=this;
  9733. var $2,$3,$1;
  9734. $2=smalltalk.send(self,"_new_",[(1)]);
  9735. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9736. $3=smalltalk.send($2,"_yourself",[]);
  9737. $1=$3;
  9738. return $1;
  9739. },
  9740. args: ["anObject"],
  9741. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  9742. messageSends: ["at:put:", "new:", "yourself"],
  9743. referencedClasses: []
  9744. }),
  9745. smalltalk.Array.klass);
  9746. smalltalk.addMethod(
  9747. "_with_with_",
  9748. smalltalk.method({
  9749. selector: "with:with:",
  9750. category: 'instance creation',
  9751. fn: function (anObject,anObject2){
  9752. var self=this;
  9753. var $2,$3,$1;
  9754. $2=smalltalk.send(self,"_new_",[(2)]);
  9755. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9756. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  9757. $3=smalltalk.send($2,"_yourself",[]);
  9758. $1=$3;
  9759. return $1;
  9760. },
  9761. args: ["anObject", "anObject2"],
  9762. 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",
  9763. messageSends: ["at:put:", "new:", "yourself"],
  9764. referencedClasses: []
  9765. }),
  9766. smalltalk.Array.klass);
  9767. smalltalk.addMethod(
  9768. "_with_with_with_",
  9769. smalltalk.method({
  9770. selector: "with:with:with:",
  9771. category: 'instance creation',
  9772. fn: function (anObject,anObject2,anObject3){
  9773. var self=this;
  9774. var $2,$3,$1;
  9775. $2=smalltalk.send(self,"_new_",[(3)]);
  9776. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9777. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  9778. smalltalk.send($2,"_at_put_",[(3),anObject3]);
  9779. $3=smalltalk.send($2,"_yourself",[]);
  9780. $1=$3;
  9781. return $1;
  9782. },
  9783. args: ["anObject", "anObject2", "anObject3"],
  9784. 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",
  9785. messageSends: ["at:put:", "new:", "yourself"],
  9786. referencedClasses: []
  9787. }),
  9788. smalltalk.Array.klass);
  9789. smalltalk.addMethod(
  9790. "_withAll_",
  9791. smalltalk.method({
  9792. selector: "withAll:",
  9793. category: 'instance creation',
  9794. fn: function (aCollection){
  9795. var self=this;
  9796. var instance;
  9797. var index;
  9798. index=(1);
  9799. instance=smalltalk.send(self,"_new_",[smalltalk.send(aCollection,"_size",[])]);
  9800. smalltalk.send(aCollection,"_do_",[(function(each){
  9801. smalltalk.send(instance,"_at_put_",[index,each]);
  9802. index=smalltalk.send(index,"__plus",[(1)]);
  9803. return index;
  9804. })]);
  9805. return instance;
  9806. },
  9807. args: ["aCollection"],
  9808. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [:each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1].\x0a\x09^instance",
  9809. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  9810. referencedClasses: []
  9811. }),
  9812. smalltalk.Array.klass);
  9813. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  9814. smalltalk.addMethod(
  9815. "__comma",
  9816. smalltalk.method({
  9817. selector: ",",
  9818. category: 'copying',
  9819. fn: function (aString){
  9820. var self=this;
  9821. var $1;
  9822. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__comma",[smalltalk.send(aString,"_asString",[])]);
  9823. return $1;
  9824. },
  9825. args: ["aString"],
  9826. source: ", aString\x0a\x09^self asString, aString asString",
  9827. messageSends: [",", "asString"],
  9828. referencedClasses: []
  9829. }),
  9830. smalltalk.CharacterArray);
  9831. smalltalk.addMethod(
  9832. "_add_",
  9833. smalltalk.method({
  9834. selector: "add:",
  9835. category: 'adding',
  9836. fn: function (anObject){
  9837. var self=this;
  9838. smalltalk.send(self,"_errorReadOnly",[]);
  9839. return self},
  9840. args: ["anObject"],
  9841. source: "add: anObject\x0a\x09self errorReadOnly",
  9842. messageSends: ["errorReadOnly"],
  9843. referencedClasses: []
  9844. }),
  9845. smalltalk.CharacterArray);
  9846. smalltalk.addMethod(
  9847. "_asLowercase",
  9848. smalltalk.method({
  9849. selector: "asLowercase",
  9850. category: 'converting',
  9851. fn: function (){
  9852. var self=this;
  9853. var $1;
  9854. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asLowercase",[])]);
  9855. return $1;
  9856. },
  9857. args: [],
  9858. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  9859. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  9860. referencedClasses: []
  9861. }),
  9862. smalltalk.CharacterArray);
  9863. smalltalk.addMethod(
  9864. "_asNumber",
  9865. smalltalk.method({
  9866. selector: "asNumber",
  9867. category: 'converting',
  9868. fn: function (){
  9869. var self=this;
  9870. var $1;
  9871. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asNumber",[]);
  9872. return $1;
  9873. },
  9874. args: [],
  9875. source: "asNumber\x0a\x09^self asString asNumber",
  9876. messageSends: ["asNumber", "asString"],
  9877. referencedClasses: []
  9878. }),
  9879. smalltalk.CharacterArray);
  9880. smalltalk.addMethod(
  9881. "_asString",
  9882. smalltalk.method({
  9883. selector: "asString",
  9884. category: 'converting',
  9885. fn: function (){
  9886. var self=this;
  9887. var $1;
  9888. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  9889. return $1;
  9890. },
  9891. args: [],
  9892. source: "asString\x0a\x09^self subclassResponsibility",
  9893. messageSends: ["subclassResponsibility"],
  9894. referencedClasses: []
  9895. }),
  9896. smalltalk.CharacterArray);
  9897. smalltalk.addMethod(
  9898. "_asSymbol",
  9899. smalltalk.method({
  9900. selector: "asSymbol",
  9901. category: 'converting',
  9902. fn: function (){
  9903. var self=this;
  9904. var $1;
  9905. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  9906. return $1;
  9907. },
  9908. args: [],
  9909. source: "asSymbol\x0a\x09^self subclassResponsibility",
  9910. messageSends: ["subclassResponsibility"],
  9911. referencedClasses: []
  9912. }),
  9913. smalltalk.CharacterArray);
  9914. smalltalk.addMethod(
  9915. "_asUppercase",
  9916. smalltalk.method({
  9917. selector: "asUppercase",
  9918. category: 'converting',
  9919. fn: function (){
  9920. var self=this;
  9921. var $1;
  9922. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asUppercase",[])]);
  9923. return $1;
  9924. },
  9925. args: [],
  9926. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  9927. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  9928. referencedClasses: []
  9929. }),
  9930. smalltalk.CharacterArray);
  9931. smalltalk.addMethod(
  9932. "_at_put_",
  9933. smalltalk.method({
  9934. selector: "at:put:",
  9935. category: 'accessing',
  9936. fn: function (anIndex,anObject){
  9937. var self=this;
  9938. smalltalk.send(self,"_errorReadOnly",[]);
  9939. return self},
  9940. args: ["anIndex", "anObject"],
  9941. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  9942. messageSends: ["errorReadOnly"],
  9943. referencedClasses: []
  9944. }),
  9945. smalltalk.CharacterArray);
  9946. smalltalk.addMethod(
  9947. "_errorReadOnly",
  9948. smalltalk.method({
  9949. selector: "errorReadOnly",
  9950. category: 'error handling',
  9951. fn: function (){
  9952. var self=this;
  9953. smalltalk.send(self,"_error_",["Object is read-only"]);
  9954. return self},
  9955. args: [],
  9956. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  9957. messageSends: ["error:"],
  9958. referencedClasses: []
  9959. }),
  9960. smalltalk.CharacterArray);
  9961. smalltalk.addMethod(
  9962. "_printString",
  9963. smalltalk.method({
  9964. selector: "printString",
  9965. category: 'printing',
  9966. fn: function (){
  9967. var self=this;
  9968. var $1;
  9969. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_printString",[]);
  9970. return $1;
  9971. },
  9972. args: [],
  9973. source: "printString\x0a\x09^self asString printString",
  9974. messageSends: ["printString", "asString"],
  9975. referencedClasses: []
  9976. }),
  9977. smalltalk.CharacterArray);
  9978. smalltalk.addMethod(
  9979. "_remove_",
  9980. smalltalk.method({
  9981. selector: "remove:",
  9982. category: 'adding',
  9983. fn: function (anObject){
  9984. var self=this;
  9985. smalltalk.send(self,"_errorReadOnly",[]);
  9986. return self},
  9987. args: ["anObject"],
  9988. source: "remove: anObject\x0a\x09self errorReadOnly",
  9989. messageSends: ["errorReadOnly"],
  9990. referencedClasses: []
  9991. }),
  9992. smalltalk.CharacterArray);
  9993. smalltalk.addMethod(
  9994. "_fromString_",
  9995. smalltalk.method({
  9996. selector: "fromString:",
  9997. category: 'instance creation',
  9998. fn: function (aString){
  9999. var self=this;
  10000. smalltalk.send(self,"_subclassResponsibility",[]);
  10001. return self},
  10002. args: ["aString"],
  10003. source: "fromString: aString\x0a\x09self subclassResponsibility",
  10004. messageSends: ["subclassResponsibility"],
  10005. referencedClasses: []
  10006. }),
  10007. smalltalk.CharacterArray.klass);
  10008. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  10009. smalltalk.addMethod(
  10010. "__comma",
  10011. smalltalk.method({
  10012. selector: ",",
  10013. category: 'copying',
  10014. fn: function (aString){
  10015. var self=this;
  10016. return self + aString;
  10017. ;
  10018. return self},
  10019. args: ["aString"],
  10020. source: ", aString\x0a\x09<return self + aString>",
  10021. messageSends: [],
  10022. referencedClasses: []
  10023. }),
  10024. smalltalk.String);
  10025. smalltalk.addMethod(
  10026. "__lt",
  10027. smalltalk.method({
  10028. selector: "<",
  10029. category: 'comparing',
  10030. fn: function (aString){
  10031. var self=this;
  10032. return String(self) < aString._asString();
  10033. ;
  10034. return self},
  10035. args: ["aString"],
  10036. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  10037. messageSends: [],
  10038. referencedClasses: []
  10039. }),
  10040. smalltalk.String);
  10041. smalltalk.addMethod(
  10042. "__lt_eq",
  10043. smalltalk.method({
  10044. selector: "<=",
  10045. category: 'comparing',
  10046. fn: function (aString){
  10047. var self=this;
  10048. return String(self) <= aString._asString();
  10049. ;
  10050. return self},
  10051. args: ["aString"],
  10052. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  10053. messageSends: [],
  10054. referencedClasses: []
  10055. }),
  10056. smalltalk.String);
  10057. smalltalk.addMethod(
  10058. "__eq",
  10059. smalltalk.method({
  10060. selector: "=",
  10061. category: 'comparing',
  10062. fn: function (aString){
  10063. var self=this;
  10064. var $1;
  10065. $1=smalltalk.send(smalltalk.send(aString,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  10066. if(! smalltalk.assert($1)){
  10067. return false;
  10068. };
  10069. return String(self) === String(aString);
  10070. ;
  10071. return self},
  10072. args: ["aString"],
  10073. source: "= aString\x0a\x09aString class = self class ifFalse: [^false].\x0a\x09<return String(self) === String(aString)>",
  10074. messageSends: ["ifFalse:", "=", "class"],
  10075. referencedClasses: []
  10076. }),
  10077. smalltalk.String);
  10078. smalltalk.addMethod(
  10079. "__eq_eq",
  10080. smalltalk.method({
  10081. selector: "==",
  10082. category: 'comparing',
  10083. fn: function (aString){
  10084. var self=this;
  10085. var $1;
  10086. $1=smalltalk.send(self,"__eq",[aString]);
  10087. return $1;
  10088. },
  10089. args: ["aString"],
  10090. source: "== aString\x0a\x09^self = aString",
  10091. messageSends: ["="],
  10092. referencedClasses: []
  10093. }),
  10094. smalltalk.String);
  10095. smalltalk.addMethod(
  10096. "__gt",
  10097. smalltalk.method({
  10098. selector: ">",
  10099. category: 'comparing',
  10100. fn: function (aString){
  10101. var self=this;
  10102. return String(self) > aString._asString();
  10103. ;
  10104. return self},
  10105. args: ["aString"],
  10106. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  10107. messageSends: [],
  10108. referencedClasses: []
  10109. }),
  10110. smalltalk.String);
  10111. smalltalk.addMethod(
  10112. "__gt_eq",
  10113. smalltalk.method({
  10114. selector: ">=",
  10115. category: 'comparing',
  10116. fn: function (aString){
  10117. var self=this;
  10118. return String(self) >= aString._asString();
  10119. ;
  10120. return self},
  10121. args: ["aString"],
  10122. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  10123. messageSends: [],
  10124. referencedClasses: []
  10125. }),
  10126. smalltalk.String);
  10127. smalltalk.addMethod(
  10128. "_asJSON",
  10129. smalltalk.method({
  10130. selector: "asJSON",
  10131. category: 'converting',
  10132. fn: function (){
  10133. var self=this;
  10134. return self;
  10135. },
  10136. args: [],
  10137. source: "asJSON\x0a\x09^self",
  10138. messageSends: [],
  10139. referencedClasses: []
  10140. }),
  10141. smalltalk.String);
  10142. smalltalk.addMethod(
  10143. "_asJavaScriptSelector",
  10144. smalltalk.method({
  10145. selector: "asJavaScriptSelector",
  10146. category: 'converting',
  10147. fn: function (){
  10148. var self=this;
  10149. var $1;
  10150. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asSelector",[]),"_replace_with_",["^_",""]),"_replace_with_",["_.*",""]);
  10151. return $1;
  10152. },
  10153. args: [],
  10154. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  10155. messageSends: ["replace:with:", "asSelector"],
  10156. referencedClasses: []
  10157. }),
  10158. smalltalk.String);
  10159. smalltalk.addMethod(
  10160. "_asJavascript",
  10161. smalltalk.method({
  10162. selector: "asJavascript",
  10163. category: 'converting',
  10164. fn: function (){
  10165. var self=this;
  10166. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10167. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10168. else
  10169. return "\"" + self + "\"";
  10170. ;
  10171. ;
  10172. return self},
  10173. args: [],
  10174. 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>",
  10175. messageSends: [],
  10176. referencedClasses: []
  10177. }),
  10178. smalltalk.String);
  10179. smalltalk.addMethod(
  10180. "_asLowercase",
  10181. smalltalk.method({
  10182. selector: "asLowercase",
  10183. category: 'converting',
  10184. fn: function (){
  10185. var self=this;
  10186. return self.toLowerCase();
  10187. ;
  10188. return self},
  10189. args: [],
  10190. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  10191. messageSends: [],
  10192. referencedClasses: []
  10193. }),
  10194. smalltalk.String);
  10195. smalltalk.addMethod(
  10196. "_asNumber",
  10197. smalltalk.method({
  10198. selector: "asNumber",
  10199. category: 'converting',
  10200. fn: function (){
  10201. var self=this;
  10202. return Number(self);
  10203. ;
  10204. return self},
  10205. args: [],
  10206. source: "asNumber\x0a\x09<return Number(self)>",
  10207. messageSends: [],
  10208. referencedClasses: []
  10209. }),
  10210. smalltalk.String);
  10211. smalltalk.addMethod(
  10212. "_asSelector",
  10213. smalltalk.method({
  10214. selector: "asSelector",
  10215. category: 'converting',
  10216. fn: function (){
  10217. var self=this;
  10218. var selector;
  10219. selector=smalltalk.send("_","__comma",[self]);
  10220. selector=smalltalk.send(selector,"_replace_with_",[":","_"]);
  10221. selector=smalltalk.send(selector,"_replace_with_",["[+]","_plus"]);
  10222. selector=smalltalk.send(selector,"_replace_with_",["-","_minus"]);
  10223. selector=smalltalk.send(selector,"_replace_with_",["[*]","_star"]);
  10224. selector=smalltalk.send(selector,"_replace_with_",["[/]","_slash"]);
  10225. selector=smalltalk.send(selector,"_replace_with_",[">","_gt"]);
  10226. selector=smalltalk.send(selector,"_replace_with_",["<","_lt"]);
  10227. selector=smalltalk.send(selector,"_replace_with_",["=","_eq"]);
  10228. selector=smalltalk.send(selector,"_replace_with_",[",","_comma"]);
  10229. selector=smalltalk.send(selector,"_replace_with_",["[@]","_at"]);
  10230. return selector;
  10231. },
  10232. args: [],
  10233. 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",
  10234. messageSends: [",", "replace:with:"],
  10235. referencedClasses: []
  10236. }),
  10237. smalltalk.String);
  10238. smalltalk.addMethod(
  10239. "_asString",
  10240. smalltalk.method({
  10241. selector: "asString",
  10242. category: 'converting',
  10243. fn: function (){
  10244. var self=this;
  10245. return self;
  10246. },
  10247. args: [],
  10248. source: "asString\x0a\x09^self",
  10249. messageSends: [],
  10250. referencedClasses: []
  10251. }),
  10252. smalltalk.String);
  10253. smalltalk.addMethod(
  10254. "_asSymbol",
  10255. smalltalk.method({
  10256. selector: "asSymbol",
  10257. category: 'converting',
  10258. fn: function (){
  10259. var self=this;
  10260. var $1;
  10261. $1=smalltalk.send((smalltalk.Symbol || Symbol),"_lookup_",[self]);
  10262. return $1;
  10263. },
  10264. args: [],
  10265. source: "asSymbol\x0a\x09^Symbol lookup: self",
  10266. messageSends: ["lookup:"],
  10267. referencedClasses: ["Symbol"]
  10268. }),
  10269. smalltalk.String);
  10270. smalltalk.addMethod(
  10271. "_asUppercase",
  10272. smalltalk.method({
  10273. selector: "asUppercase",
  10274. category: 'converting',
  10275. fn: function (){
  10276. var self=this;
  10277. return self.toUpperCase();
  10278. ;
  10279. return self},
  10280. args: [],
  10281. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  10282. messageSends: [],
  10283. referencedClasses: []
  10284. }),
  10285. smalltalk.String);
  10286. smalltalk.addMethod(
  10287. "_asciiValue",
  10288. smalltalk.method({
  10289. selector: "asciiValue",
  10290. category: 'accessing',
  10291. fn: function (){
  10292. var self=this;
  10293. return self.charCodeAt(0);;
  10294. ;
  10295. return self},
  10296. args: [],
  10297. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  10298. messageSends: [],
  10299. referencedClasses: []
  10300. }),
  10301. smalltalk.String);
  10302. smalltalk.addMethod(
  10303. "_at_ifAbsent_",
  10304. smalltalk.method({
  10305. selector: "at:ifAbsent:",
  10306. category: 'accessing',
  10307. fn: function (anIndex,aBlock){
  10308. var self=this;
  10309. return String(self).charAt(anIndex - 1) || aBlock();
  10310. ;
  10311. return self},
  10312. args: ["anIndex", "aBlock"],
  10313. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  10314. messageSends: [],
  10315. referencedClasses: []
  10316. }),
  10317. smalltalk.String);
  10318. smalltalk.addMethod(
  10319. "_copyFrom_to_",
  10320. smalltalk.method({
  10321. selector: "copyFrom:to:",
  10322. category: 'copying',
  10323. fn: function (anIndex,anotherIndex){
  10324. var self=this;
  10325. return self.substring(anIndex - 1, anotherIndex);
  10326. ;
  10327. return self},
  10328. args: ["anIndex", "anotherIndex"],
  10329. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  10330. messageSends: [],
  10331. referencedClasses: []
  10332. }),
  10333. smalltalk.String);
  10334. smalltalk.addMethod(
  10335. "_deepCopy",
  10336. smalltalk.method({
  10337. selector: "deepCopy",
  10338. category: 'copying',
  10339. fn: function (){
  10340. var self=this;
  10341. var $1;
  10342. $1=smalltalk.send(self,"_shallowCopy",[]);
  10343. return $1;
  10344. },
  10345. args: [],
  10346. source: "deepCopy\x0a\x09^self shallowCopy",
  10347. messageSends: ["shallowCopy"],
  10348. referencedClasses: []
  10349. }),
  10350. smalltalk.String);
  10351. smalltalk.addMethod(
  10352. "_do_",
  10353. smalltalk.method({
  10354. selector: "do:",
  10355. category: 'enumerating',
  10356. fn: function (aBlock){
  10357. var self=this;
  10358. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  10359. ;
  10360. return self},
  10361. args: ["aBlock"],
  10362. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  10363. messageSends: [],
  10364. referencedClasses: []
  10365. }),
  10366. smalltalk.String);
  10367. smalltalk.addMethod(
  10368. "_escaped",
  10369. smalltalk.method({
  10370. selector: "escaped",
  10371. category: 'accessing',
  10372. fn: function (){
  10373. var self=this;
  10374. return escape(self);
  10375. ;
  10376. return self},
  10377. args: [],
  10378. source: "escaped\x0a\x09<return escape(self)>",
  10379. messageSends: [],
  10380. referencedClasses: []
  10381. }),
  10382. smalltalk.String);
  10383. smalltalk.addMethod(
  10384. "_includesSubString_",
  10385. smalltalk.method({
  10386. selector: "includesSubString:",
  10387. category: 'testing',
  10388. fn: function (subString){
  10389. var self=this;
  10390. return self.indexOf(subString) != -1 ;
  10391. ;
  10392. return self},
  10393. args: ["subString"],
  10394. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  10395. messageSends: [],
  10396. referencedClasses: []
  10397. }),
  10398. smalltalk.String);
  10399. smalltalk.addMethod(
  10400. "_isString",
  10401. smalltalk.method({
  10402. selector: "isString",
  10403. category: 'testing',
  10404. fn: function (){
  10405. var self=this;
  10406. return true;
  10407. },
  10408. args: [],
  10409. source: "isString\x0a\x09^true",
  10410. messageSends: [],
  10411. referencedClasses: []
  10412. }),
  10413. smalltalk.String);
  10414. smalltalk.addMethod(
  10415. "_join_",
  10416. smalltalk.method({
  10417. selector: "join:",
  10418. category: 'split join',
  10419. fn: function (aCollection){
  10420. var self=this;
  10421. var $1;
  10422. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  10423. return smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  10424. return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(each,"_asString",[])]);
  10425. }),(function(){
  10426. return smalltalk.send(stream,"_nextPutAll_",[self]);
  10427. })]);
  10428. })]);
  10429. return $1;
  10430. },
  10431. args: ["aCollection"],
  10432. 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]]",
  10433. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  10434. referencedClasses: ["String"]
  10435. }),
  10436. smalltalk.String);
  10437. smalltalk.addMethod(
  10438. "_lineIndicesDo_",
  10439. smalltalk.method({
  10440. selector: "lineIndicesDo:",
  10441. category: 'split join',
  10442. fn: function (aBlock){
  10443. var self=this;
  10444. var $1,$2,$3;
  10445. var $early={};
  10446. try {
  10447. var cr;
  10448. var lf;
  10449. var start;
  10450. var sz;
  10451. var nextLF;
  10452. var nextCR;
  10453. start=(1);
  10454. sz=smalltalk.send(self,"_size",[]);
  10455. cr=smalltalk.send((smalltalk.String || String),"_cr",[]);
  10456. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,(1)]);
  10457. lf=smalltalk.send((smalltalk.String || String),"_lf",[]);
  10458. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,(1)]);
  10459. smalltalk.send((function(){
  10460. return smalltalk.send(start,"__lt_eq",[sz]);
  10461. }),"_whileTrue_",[(function(){
  10462. $1=smalltalk.send(smalltalk.send(nextLF,"__eq",[(0)]),"_and_",[(function(){
  10463. return smalltalk.send(nextCR,"__eq",[(0)]);
  10464. })]);
  10465. if(smalltalk.assert($1)){
  10466. smalltalk.send(aBlock,"_value_value_value_",[start,sz,sz]);
  10467. throw $early=[self];
  10468. };
  10469. $2=smalltalk.send(smalltalk.send(nextCR,"__eq",[(0)]),"_or_",[(function(){
  10470. return smalltalk.send(smalltalk.send((0),"__lt",[nextLF]),"_and_",[(function(){
  10471. return smalltalk.send(nextLF,"__lt",[nextCR]);
  10472. })]);
  10473. })]);
  10474. if(smalltalk.assert($2)){
  10475. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextLF,"__minus",[(1)]),nextLF]);
  10476. start=smalltalk.send((1),"__plus",[nextLF]);
  10477. start;
  10478. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  10479. return nextLF;
  10480. } else {
  10481. $3=smalltalk.send(smalltalk.send((1),"__plus",[nextCR]),"__eq",[nextLF]);
  10482. if(smalltalk.assert($3)){
  10483. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextLF]);
  10484. start=smalltalk.send((1),"__plus",[nextLF]);
  10485. start;
  10486. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  10487. nextCR;
  10488. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  10489. return nextLF;
  10490. } else {
  10491. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextCR]);
  10492. start=smalltalk.send((1),"__plus",[nextCR]);
  10493. start;
  10494. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  10495. return nextCR;
  10496. };
  10497. };
  10498. })]);
  10499. return self}
  10500. catch(e) {if(e===$early)return e[0]; throw e}
  10501. },
  10502. args: ["aBlock"],
  10503. 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 ]]]",
  10504. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  10505. referencedClasses: ["String"]
  10506. }),
  10507. smalltalk.String);
  10508. smalltalk.addMethod(
  10509. "_lineNumber_",
  10510. smalltalk.method({
  10511. selector: "lineNumber:",
  10512. category: 'split join',
  10513. fn: function (anIndex){
  10514. var self=this;
  10515. var $1,$2;
  10516. var $early={};
  10517. try {
  10518. var lineCount;
  10519. lineCount=(0);
  10520. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  10521. lineCount=smalltalk.send(lineCount,"__plus",[(1)]);
  10522. $1=smalltalk.send(lineCount,"__eq",[anIndex]);
  10523. if(smalltalk.assert($1)){
  10524. $2=smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters]);
  10525. throw $early=[$2];
  10526. };
  10527. })]);
  10528. return nil;
  10529. }
  10530. catch(e) {if(e===$early)return e[0]; throw e}
  10531. },
  10532. args: ["anIndex"],
  10533. 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",
  10534. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  10535. referencedClasses: []
  10536. }),
  10537. smalltalk.String);
  10538. smalltalk.addMethod(
  10539. "_lines",
  10540. smalltalk.method({
  10541. selector: "lines",
  10542. category: 'split join',
  10543. fn: function (){
  10544. var self=this;
  10545. var lines;
  10546. lines=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  10547. smalltalk.send(self,"_linesDo_",[(function(aLine){
  10548. return smalltalk.send(lines,"_add_",[aLine]);
  10549. })]);
  10550. return lines;
  10551. },
  10552. args: [],
  10553. 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",
  10554. messageSends: ["new", "linesDo:", "add:"],
  10555. referencedClasses: ["Array"]
  10556. }),
  10557. smalltalk.String);
  10558. smalltalk.addMethod(
  10559. "_linesDo_",
  10560. smalltalk.method({
  10561. selector: "linesDo:",
  10562. category: 'split join',
  10563. fn: function (aBlock){
  10564. var self=this;
  10565. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  10566. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters])]);
  10567. })]);
  10568. return self},
  10569. args: ["aBlock"],
  10570. 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)]",
  10571. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  10572. referencedClasses: []
  10573. }),
  10574. smalltalk.String);
  10575. smalltalk.addMethod(
  10576. "_match_",
  10577. smalltalk.method({
  10578. selector: "match:",
  10579. category: 'regular expressions',
  10580. fn: function (aRegexp){
  10581. var self=this;
  10582. return self.search(aRegexp) != -1;
  10583. ;
  10584. return self},
  10585. args: ["aRegexp"],
  10586. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  10587. messageSends: [],
  10588. referencedClasses: []
  10589. }),
  10590. smalltalk.String);
  10591. smalltalk.addMethod(
  10592. "_matchesOf_",
  10593. smalltalk.method({
  10594. selector: "matchesOf:",
  10595. category: 'regular expressions',
  10596. fn: function (aRegularExpression){
  10597. var self=this;
  10598. return self.match(aRegularExpression);
  10599. ;
  10600. return self},
  10601. args: ["aRegularExpression"],
  10602. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  10603. messageSends: [],
  10604. referencedClasses: []
  10605. }),
  10606. smalltalk.String);
  10607. smalltalk.addMethod(
  10608. "_printNl",
  10609. smalltalk.method({
  10610. selector: "printNl",
  10611. category: 'printing',
  10612. fn: function (){
  10613. var self=this;
  10614. console.log(self);
  10615. ;
  10616. return self},
  10617. args: [],
  10618. source: "printNl\x0a\x09<console.log(self)>",
  10619. messageSends: [],
  10620. referencedClasses: []
  10621. }),
  10622. smalltalk.String);
  10623. smalltalk.addMethod(
  10624. "_printString",
  10625. smalltalk.method({
  10626. selector: "printString",
  10627. category: 'printing',
  10628. fn: function (){
  10629. var self=this;
  10630. var $1;
  10631. $1=smalltalk.send(smalltalk.send("'","__comma",[self]),"__comma",["'"]);
  10632. return $1;
  10633. },
  10634. args: [],
  10635. source: "printString\x0a\x09^'''', self, ''''",
  10636. messageSends: [","],
  10637. referencedClasses: []
  10638. }),
  10639. smalltalk.String);
  10640. smalltalk.addMethod(
  10641. "_replace_with_",
  10642. smalltalk.method({
  10643. selector: "replace:with:",
  10644. category: 'regular expressions',
  10645. fn: function (aString,anotherString){
  10646. var self=this;
  10647. var $1;
  10648. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[aString,"g"]),anotherString]);
  10649. return $1;
  10650. },
  10651. args: ["aString", "anotherString"],
  10652. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  10653. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  10654. referencedClasses: ["RegularExpression"]
  10655. }),
  10656. smalltalk.String);
  10657. smalltalk.addMethod(
  10658. "_replaceRegexp_with_",
  10659. smalltalk.method({
  10660. selector: "replaceRegexp:with:",
  10661. category: 'regular expressions',
  10662. fn: function (aRegexp,aString){
  10663. var self=this;
  10664. return self.replace(aRegexp, aString);
  10665. ;
  10666. return self},
  10667. args: ["aRegexp", "aString"],
  10668. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  10669. messageSends: [],
  10670. referencedClasses: []
  10671. }),
  10672. smalltalk.String);
  10673. smalltalk.addMethod(
  10674. "_reversed",
  10675. smalltalk.method({
  10676. selector: "reversed",
  10677. category: 'converting',
  10678. fn: function (){
  10679. var self=this;
  10680. return self.split("").reverse().join("");
  10681. ;
  10682. return self},
  10683. args: [],
  10684. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  10685. messageSends: [],
  10686. referencedClasses: []
  10687. }),
  10688. smalltalk.String);
  10689. smalltalk.addMethod(
  10690. "_shallowCopy",
  10691. smalltalk.method({
  10692. selector: "shallowCopy",
  10693. category: 'copying',
  10694. fn: function (){
  10695. var self=this;
  10696. var $1;
  10697. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[self]);
  10698. return $1;
  10699. },
  10700. args: [],
  10701. source: "shallowCopy\x0a\x09^self class fromString: self",
  10702. messageSends: ["fromString:", "class"],
  10703. referencedClasses: []
  10704. }),
  10705. smalltalk.String);
  10706. smalltalk.addMethod(
  10707. "_size",
  10708. smalltalk.method({
  10709. selector: "size",
  10710. category: 'accessing',
  10711. fn: function (){
  10712. var self=this;
  10713. return self.length;
  10714. ;
  10715. return self},
  10716. args: [],
  10717. source: "size\x0a\x09<return self.length>",
  10718. messageSends: [],
  10719. referencedClasses: []
  10720. }),
  10721. smalltalk.String);
  10722. smalltalk.addMethod(
  10723. "_tokenize_",
  10724. smalltalk.method({
  10725. selector: "tokenize:",
  10726. category: 'converting',
  10727. fn: function (aString){
  10728. var self=this;
  10729. return self.split(aString);
  10730. ;
  10731. return self},
  10732. args: ["aString"],
  10733. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  10734. messageSends: [],
  10735. referencedClasses: []
  10736. }),
  10737. smalltalk.String);
  10738. smalltalk.addMethod(
  10739. "_trimBoth",
  10740. smalltalk.method({
  10741. selector: "trimBoth",
  10742. category: 'regular expressions',
  10743. fn: function (){
  10744. var self=this;
  10745. var $1;
  10746. $1=smalltalk.send(self,"_trimBoth_",["\x5cs"]);
  10747. return $1;
  10748. },
  10749. args: [],
  10750. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  10751. messageSends: ["trimBoth:"],
  10752. referencedClasses: []
  10753. }),
  10754. smalltalk.String);
  10755. smalltalk.addMethod(
  10756. "_trimBoth_",
  10757. smalltalk.method({
  10758. selector: "trimBoth:",
  10759. category: 'regular expressions',
  10760. fn: function (separators){
  10761. var self=this;
  10762. var $1;
  10763. $1=smalltalk.send(smalltalk.send(self,"_trimLeft_",[separators]),"_trimRight_",[separators]);
  10764. return $1;
  10765. },
  10766. args: ["separators"],
  10767. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  10768. messageSends: ["trimRight:", "trimLeft:"],
  10769. referencedClasses: []
  10770. }),
  10771. smalltalk.String);
  10772. smalltalk.addMethod(
  10773. "_trimLeft",
  10774. smalltalk.method({
  10775. selector: "trimLeft",
  10776. category: 'regular expressions',
  10777. fn: function (){
  10778. var self=this;
  10779. var $1;
  10780. $1=smalltalk.send(self,"_trimLeft_",["\x5cs"]);
  10781. return $1;
  10782. },
  10783. args: [],
  10784. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  10785. messageSends: ["trimLeft:"],
  10786. referencedClasses: []
  10787. }),
  10788. smalltalk.String);
  10789. smalltalk.addMethod(
  10790. "_trimLeft_",
  10791. smalltalk.method({
  10792. selector: "trimLeft:",
  10793. category: 'regular expressions',
  10794. fn: function (separators){
  10795. var self=this;
  10796. var $1;
  10797. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("^[","__comma",[separators]),"__comma",["]+"]),"g"]),""]);
  10798. return $1;
  10799. },
  10800. args: ["separators"],
  10801. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  10802. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  10803. referencedClasses: ["RegularExpression"]
  10804. }),
  10805. smalltalk.String);
  10806. smalltalk.addMethod(
  10807. "_trimRight",
  10808. smalltalk.method({
  10809. selector: "trimRight",
  10810. category: 'regular expressions',
  10811. fn: function (){
  10812. var self=this;
  10813. var $1;
  10814. $1=smalltalk.send(self,"_trimRight_",["\x5cs"]);
  10815. return $1;
  10816. },
  10817. args: [],
  10818. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  10819. messageSends: ["trimRight:"],
  10820. referencedClasses: []
  10821. }),
  10822. smalltalk.String);
  10823. smalltalk.addMethod(
  10824. "_trimRight_",
  10825. smalltalk.method({
  10826. selector: "trimRight:",
  10827. category: 'regular expressions',
  10828. fn: function (separators){
  10829. var self=this;
  10830. var $1;
  10831. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("[","__comma",[separators]),"__comma",["]+$"]),"g"]),""]);
  10832. return $1;
  10833. },
  10834. args: ["separators"],
  10835. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  10836. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  10837. referencedClasses: ["RegularExpression"]
  10838. }),
  10839. smalltalk.String);
  10840. smalltalk.addMethod(
  10841. "_unescaped",
  10842. smalltalk.method({
  10843. selector: "unescaped",
  10844. category: 'accessing',
  10845. fn: function (){
  10846. var self=this;
  10847. return unescape(self);
  10848. ;
  10849. return self},
  10850. args: [],
  10851. source: "unescaped\x0a\x09<return unescape(self)>",
  10852. messageSends: [],
  10853. referencedClasses: []
  10854. }),
  10855. smalltalk.String);
  10856. smalltalk.addMethod(
  10857. "_withIndexDo_",
  10858. smalltalk.method({
  10859. selector: "withIndexDo:",
  10860. category: 'enumerating',
  10861. fn: function (aBlock){
  10862. var self=this;
  10863. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  10864. ;
  10865. return self},
  10866. args: ["aBlock"],
  10867. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  10868. messageSends: [],
  10869. referencedClasses: []
  10870. }),
  10871. smalltalk.String);
  10872. smalltalk.addMethod(
  10873. "_cr",
  10874. smalltalk.method({
  10875. selector: "cr",
  10876. category: 'accessing',
  10877. fn: function (){
  10878. var self=this;
  10879. return '\r';
  10880. ;
  10881. return self},
  10882. args: [],
  10883. source: "cr\x0a\x09<return '\x5cr'>",
  10884. messageSends: [],
  10885. referencedClasses: []
  10886. }),
  10887. smalltalk.String.klass);
  10888. smalltalk.addMethod(
  10889. "_crlf",
  10890. smalltalk.method({
  10891. selector: "crlf",
  10892. category: 'accessing',
  10893. fn: function (){
  10894. var self=this;
  10895. return '\r\n';
  10896. ;
  10897. return self},
  10898. args: [],
  10899. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  10900. messageSends: [],
  10901. referencedClasses: []
  10902. }),
  10903. smalltalk.String.klass);
  10904. smalltalk.addMethod(
  10905. "_fromCharCode_",
  10906. smalltalk.method({
  10907. selector: "fromCharCode:",
  10908. category: 'instance creation',
  10909. fn: function (anInteger){
  10910. var self=this;
  10911. return String.fromCharCode(anInteger);
  10912. ;
  10913. return self},
  10914. args: ["anInteger"],
  10915. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  10916. messageSends: [],
  10917. referencedClasses: []
  10918. }),
  10919. smalltalk.String.klass);
  10920. smalltalk.addMethod(
  10921. "_fromString_",
  10922. smalltalk.method({
  10923. selector: "fromString:",
  10924. category: 'instance creation',
  10925. fn: function (aString){
  10926. var self=this;
  10927. return new self.fn(aString);
  10928. ;
  10929. return self},
  10930. args: ["aString"],
  10931. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  10932. messageSends: [],
  10933. referencedClasses: []
  10934. }),
  10935. smalltalk.String.klass);
  10936. smalltalk.addMethod(
  10937. "_lf",
  10938. smalltalk.method({
  10939. selector: "lf",
  10940. category: 'accessing',
  10941. fn: function (){
  10942. var self=this;
  10943. return '\n';
  10944. ;
  10945. return self},
  10946. args: [],
  10947. source: "lf\x0a\x09<return '\x5cn'>",
  10948. messageSends: [],
  10949. referencedClasses: []
  10950. }),
  10951. smalltalk.String.klass);
  10952. smalltalk.addMethod(
  10953. "_space",
  10954. smalltalk.method({
  10955. selector: "space",
  10956. category: 'accessing',
  10957. fn: function (){
  10958. var self=this;
  10959. return ' ';
  10960. ;
  10961. return self},
  10962. args: [],
  10963. source: "space\x0a\x09<return ' '>",
  10964. messageSends: [],
  10965. referencedClasses: []
  10966. }),
  10967. smalltalk.String.klass);
  10968. smalltalk.addMethod(
  10969. "_streamClass",
  10970. smalltalk.method({
  10971. selector: "streamClass",
  10972. category: 'accessing',
  10973. fn: function (){
  10974. var self=this;
  10975. return (smalltalk.StringStream || StringStream);
  10976. },
  10977. args: [],
  10978. source: "streamClass\x0a\x09 ^StringStream",
  10979. messageSends: [],
  10980. referencedClasses: ["StringStream"]
  10981. }),
  10982. smalltalk.String.klass);
  10983. smalltalk.addMethod(
  10984. "_streamContents_",
  10985. smalltalk.method({
  10986. selector: "streamContents:",
  10987. category: 'instance creation',
  10988. fn: function (blockWithArg){
  10989. var self=this;
  10990. var $1;
  10991. var stream;
  10992. stream=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[smalltalk.send((smalltalk.String || String),"_new",[])]);
  10993. smalltalk.send(blockWithArg,"_value_",[stream]);
  10994. $1=smalltalk.send(stream,"_contents",[]);
  10995. return $1;
  10996. },
  10997. args: ["blockWithArg"],
  10998. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  10999. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  11000. referencedClasses: ["String"]
  11001. }),
  11002. smalltalk.String.klass);
  11003. smalltalk.addMethod(
  11004. "_tab",
  11005. smalltalk.method({
  11006. selector: "tab",
  11007. category: 'accessing',
  11008. fn: function (){
  11009. var self=this;
  11010. return '\t';
  11011. ;
  11012. return self},
  11013. args: [],
  11014. source: "tab\x0a\x09<return '\x5ct'>",
  11015. messageSends: [],
  11016. referencedClasses: []
  11017. }),
  11018. smalltalk.String.klass);
  11019. smalltalk.addMethod(
  11020. "_value_",
  11021. smalltalk.method({
  11022. selector: "value:",
  11023. category: 'instance creation',
  11024. fn: function (aUTFCharCode){
  11025. var self=this;
  11026. return String.fromCharCode(aUTFCharCode);;
  11027. ;
  11028. return self},
  11029. args: ["aUTFCharCode"],
  11030. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  11031. messageSends: [],
  11032. referencedClasses: []
  11033. }),
  11034. smalltalk.String.klass);
  11035. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  11036. smalltalk.addMethod(
  11037. "__lt",
  11038. smalltalk.method({
  11039. selector: "<",
  11040. category: 'comparing',
  11041. fn: function (aSymbol){
  11042. var self=this;
  11043. var $1;
  11044. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt",[smalltalk.send(aSymbol,"_asString",[])]);
  11045. return $1;
  11046. },
  11047. args: ["aSymbol"],
  11048. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  11049. messageSends: ["<", "asString"],
  11050. referencedClasses: []
  11051. }),
  11052. smalltalk.Symbol);
  11053. smalltalk.addMethod(
  11054. "__lt_eq",
  11055. smalltalk.method({
  11056. selector: "<=",
  11057. category: 'comparing',
  11058. fn: function (aSymbol){
  11059. var self=this;
  11060. var $1;
  11061. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11062. return $1;
  11063. },
  11064. args: ["aSymbol"],
  11065. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  11066. messageSends: ["<=", "asString"],
  11067. referencedClasses: []
  11068. }),
  11069. smalltalk.Symbol);
  11070. smalltalk.addMethod(
  11071. "__eq",
  11072. smalltalk.method({
  11073. selector: "=",
  11074. category: 'comparing',
  11075. fn: function (aSymbol){
  11076. var self=this;
  11077. var $1,$2;
  11078. $1=smalltalk.send(smalltalk.send(aSymbol,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  11079. if(! smalltalk.assert($1)){
  11080. return false;
  11081. };
  11082. $2=smalltalk.send(smalltalk.send(self,"_asString",[]),"__eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11083. return $2;
  11084. },
  11085. args: ["aSymbol"],
  11086. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  11087. messageSends: ["ifFalse:", "=", "class", "asString"],
  11088. referencedClasses: []
  11089. }),
  11090. smalltalk.Symbol);
  11091. smalltalk.addMethod(
  11092. "__gt",
  11093. smalltalk.method({
  11094. selector: ">",
  11095. category: 'comparing',
  11096. fn: function (aSymbol){
  11097. var self=this;
  11098. var $1;
  11099. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt",[smalltalk.send(aSymbol,"_asString",[])]);
  11100. return $1;
  11101. },
  11102. args: ["aSymbol"],
  11103. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  11104. messageSends: [">", "asString"],
  11105. referencedClasses: []
  11106. }),
  11107. smalltalk.Symbol);
  11108. smalltalk.addMethod(
  11109. "__gt_eq",
  11110. smalltalk.method({
  11111. selector: ">=",
  11112. category: 'comparing',
  11113. fn: function (aSymbol){
  11114. var self=this;
  11115. var $1;
  11116. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11117. return $1;
  11118. },
  11119. args: ["aSymbol"],
  11120. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  11121. messageSends: [">=", "asString"],
  11122. referencedClasses: []
  11123. }),
  11124. smalltalk.Symbol);
  11125. smalltalk.addMethod(
  11126. "_asJSON",
  11127. smalltalk.method({
  11128. selector: "asJSON",
  11129. category: 'converting',
  11130. fn: function (){
  11131. var self=this;
  11132. var $1;
  11133. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asJSON",[]);
  11134. return $1;
  11135. },
  11136. args: [],
  11137. source: "asJSON\x0a\x09^self asString asJSON",
  11138. messageSends: ["asJSON", "asString"],
  11139. referencedClasses: []
  11140. }),
  11141. smalltalk.Symbol);
  11142. smalltalk.addMethod(
  11143. "_asJavascript",
  11144. smalltalk.method({
  11145. selector: "asJavascript",
  11146. category: 'converting',
  11147. fn: function (){
  11148. var self=this;
  11149. var $1;
  11150. $1=smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22","__comma",[smalltalk.send(self,"_asString",[])]),"__comma",["\x22)"]);
  11151. return $1;
  11152. },
  11153. args: [],
  11154. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(\x22', self asString, '\x22)'",
  11155. messageSends: [",", "asString"],
  11156. referencedClasses: []
  11157. }),
  11158. smalltalk.Symbol);
  11159. smalltalk.addMethod(
  11160. "_asSelector",
  11161. smalltalk.method({
  11162. selector: "asSelector",
  11163. category: 'converting',
  11164. fn: function (){
  11165. var self=this;
  11166. var $1;
  11167. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asSelector",[]);
  11168. return $1;
  11169. },
  11170. args: [],
  11171. source: "asSelector\x0a\x09^self asString asSelector",
  11172. messageSends: ["asSelector", "asString"],
  11173. referencedClasses: []
  11174. }),
  11175. smalltalk.Symbol);
  11176. smalltalk.addMethod(
  11177. "_asString",
  11178. smalltalk.method({
  11179. selector: "asString",
  11180. category: 'converting',
  11181. fn: function (){
  11182. var self=this;
  11183. return self.value;
  11184. ;
  11185. return self},
  11186. args: [],
  11187. source: "asString\x0a\x09<return self.value>",
  11188. messageSends: [],
  11189. referencedClasses: []
  11190. }),
  11191. smalltalk.Symbol);
  11192. smalltalk.addMethod(
  11193. "_asSymbol",
  11194. smalltalk.method({
  11195. selector: "asSymbol",
  11196. category: 'converting',
  11197. fn: function (){
  11198. var self=this;
  11199. return self;
  11200. },
  11201. args: [],
  11202. source: "asSymbol\x0a\x09^self",
  11203. messageSends: [],
  11204. referencedClasses: []
  11205. }),
  11206. smalltalk.Symbol);
  11207. smalltalk.addMethod(
  11208. "_at_ifAbsent_",
  11209. smalltalk.method({
  11210. selector: "at:ifAbsent:",
  11211. category: 'accessing',
  11212. fn: function (anIndex,aBlock){
  11213. var self=this;
  11214. var $1;
  11215. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_at_ifAbsent_",[anIndex,aBlock]);
  11216. return $1;
  11217. },
  11218. args: ["anIndex", "aBlock"],
  11219. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  11220. messageSends: ["at:ifAbsent:", "asString"],
  11221. referencedClasses: []
  11222. }),
  11223. smalltalk.Symbol);
  11224. smalltalk.addMethod(
  11225. "_collect_",
  11226. smalltalk.method({
  11227. selector: "collect:",
  11228. category: 'enumerating',
  11229. fn: function (aBlock){
  11230. var self=this;
  11231. var $1;
  11232. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_collect_",[aBlock]),"_asSymbol",[]);
  11233. return $1;
  11234. },
  11235. args: ["aBlock"],
  11236. source: "collect: aBlock\x0a\x09^ (self asString collect: aBlock) asSymbol",
  11237. messageSends: ["asSymbol", "collect:", "asString"],
  11238. referencedClasses: []
  11239. }),
  11240. smalltalk.Symbol);
  11241. smalltalk.addMethod(
  11242. "_copyFrom_to_",
  11243. smalltalk.method({
  11244. selector: "copyFrom:to:",
  11245. category: 'copying',
  11246. fn: function (anIndex,anotherIndex){
  11247. var self=this;
  11248. var $1;
  11249. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_copyFrom_to_",[anIndex,anotherIndex])]);
  11250. return $1;
  11251. },
  11252. args: ["anIndex", "anotherIndex"],
  11253. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  11254. messageSends: ["fromString:", "copyFrom:to:", "asString", "class"],
  11255. referencedClasses: []
  11256. }),
  11257. smalltalk.Symbol);
  11258. smalltalk.addMethod(
  11259. "_deepCopy",
  11260. smalltalk.method({
  11261. selector: "deepCopy",
  11262. category: 'copying',
  11263. fn: function (){
  11264. var self=this;
  11265. return self;
  11266. },
  11267. args: [],
  11268. source: "deepCopy\x0a\x09^self",
  11269. messageSends: [],
  11270. referencedClasses: []
  11271. }),
  11272. smalltalk.Symbol);
  11273. smalltalk.addMethod(
  11274. "_detect_",
  11275. smalltalk.method({
  11276. selector: "detect:",
  11277. category: 'enumerating',
  11278. fn: function (aBlock){
  11279. var self=this;
  11280. var $1;
  11281. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_detect_",[aBlock]);
  11282. return $1;
  11283. },
  11284. args: ["aBlock"],
  11285. source: "detect: aBlock\x0a\x09^ self asString detect: aBlock",
  11286. messageSends: ["detect:", "asString"],
  11287. referencedClasses: []
  11288. }),
  11289. smalltalk.Symbol);
  11290. smalltalk.addMethod(
  11291. "_do_",
  11292. smalltalk.method({
  11293. selector: "do:",
  11294. category: 'enumerating',
  11295. fn: function (aBlock){
  11296. var self=this;
  11297. smalltalk.send(smalltalk.send(self,"_asString",[]),"_do_",[aBlock]);
  11298. return self},
  11299. args: ["aBlock"],
  11300. source: "do: aBlock\x0a\x09self asString do: aBlock",
  11301. messageSends: ["do:", "asString"],
  11302. referencedClasses: []
  11303. }),
  11304. smalltalk.Symbol);
  11305. smalltalk.addMethod(
  11306. "_isSymbol",
  11307. smalltalk.method({
  11308. selector: "isSymbol",
  11309. category: 'printing',
  11310. fn: function (){
  11311. var self=this;
  11312. return true;
  11313. },
  11314. args: [],
  11315. source: "isSymbol\x0a\x09^true",
  11316. messageSends: [],
  11317. referencedClasses: []
  11318. }),
  11319. smalltalk.Symbol);
  11320. smalltalk.addMethod(
  11321. "_printString",
  11322. smalltalk.method({
  11323. selector: "printString",
  11324. category: 'printing',
  11325. fn: function (){
  11326. var self=this;
  11327. var $1;
  11328. $1=smalltalk.send("#","__comma",[smalltalk.send(self,"_asString",[])]);
  11329. return $1;
  11330. },
  11331. args: [],
  11332. source: "printString\x0a\x09^'#', self asString",
  11333. messageSends: [",", "asString"],
  11334. referencedClasses: []
  11335. }),
  11336. smalltalk.Symbol);
  11337. smalltalk.addMethod(
  11338. "_select_",
  11339. smalltalk.method({
  11340. selector: "select:",
  11341. category: 'enumerating',
  11342. fn: function (aBlock){
  11343. var self=this;
  11344. var $1;
  11345. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_select_",[aBlock]),"_asSymbol",[]);
  11346. return $1;
  11347. },
  11348. args: ["aBlock"],
  11349. source: "select: aBlock\x0a\x09^ (self asString select: aBlock) asSymbol",
  11350. messageSends: ["asSymbol", "select:", "asString"],
  11351. referencedClasses: []
  11352. }),
  11353. smalltalk.Symbol);
  11354. smalltalk.addMethod(
  11355. "_shallowCopy",
  11356. smalltalk.method({
  11357. selector: "shallowCopy",
  11358. category: 'copying',
  11359. fn: function (){
  11360. var self=this;
  11361. return self;
  11362. },
  11363. args: [],
  11364. source: "shallowCopy\x0a\x09^self",
  11365. messageSends: [],
  11366. referencedClasses: []
  11367. }),
  11368. smalltalk.Symbol);
  11369. smalltalk.addMethod(
  11370. "_size",
  11371. smalltalk.method({
  11372. selector: "size",
  11373. category: 'accessing',
  11374. fn: function (){
  11375. var self=this;
  11376. var $1;
  11377. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_size",[]);
  11378. return $1;
  11379. },
  11380. args: [],
  11381. source: "size\x0a\x09^self asString size",
  11382. messageSends: ["size", "asString"],
  11383. referencedClasses: []
  11384. }),
  11385. smalltalk.Symbol);
  11386. smalltalk.addMethod(
  11387. "_value_",
  11388. smalltalk.method({
  11389. selector: "value:",
  11390. category: 'evaluating',
  11391. fn: function (anObject){
  11392. var self=this;
  11393. var $1;
  11394. $1=smalltalk.send(anObject,"_perform_",[self]);
  11395. return $1;
  11396. },
  11397. args: ["anObject"],
  11398. source: "value: anObject \x0a\x09^anObject perform: self",
  11399. messageSends: ["perform:"],
  11400. referencedClasses: []
  11401. }),
  11402. smalltalk.Symbol);
  11403. smalltalk.addMethod(
  11404. "_withIndexDo_",
  11405. smalltalk.method({
  11406. selector: "withIndexDo:",
  11407. category: 'enumerating',
  11408. fn: function (aBlock){
  11409. var self=this;
  11410. smalltalk.send(smalltalk.send(self,"_asString",[]),"_withIndexDo_",[aBlock]);
  11411. return self},
  11412. args: ["aBlock"],
  11413. source: "withIndexDo: aBlock\x0a\x09self asString withIndexDo: aBlock",
  11414. messageSends: ["withIndexDo:", "asString"],
  11415. referencedClasses: []
  11416. }),
  11417. smalltalk.Symbol);
  11418. smalltalk.addMethod(
  11419. "_basicNew",
  11420. smalltalk.method({
  11421. selector: "basicNew",
  11422. category: 'instance creation',
  11423. fn: function (){
  11424. var self=this;
  11425. smalltalk.send(self,"_shouldNotImplement",[]);
  11426. return self},
  11427. args: [],
  11428. source: "basicNew\x0a\x09self shouldNotImplement",
  11429. messageSends: ["shouldNotImplement"],
  11430. referencedClasses: []
  11431. }),
  11432. smalltalk.Symbol.klass);
  11433. smalltalk.addMethod(
  11434. "_fromString_",
  11435. smalltalk.method({
  11436. selector: "fromString:",
  11437. category: 'instance creation',
  11438. fn: function (aString){
  11439. var self=this;
  11440. var $1;
  11441. $1=smalltalk.send(self,"_lookup_",[aString]);
  11442. return $1;
  11443. },
  11444. args: ["aString"],
  11445. source: "fromString: aString\x0a\x09^self lookup: aString",
  11446. messageSends: ["lookup:"],
  11447. referencedClasses: []
  11448. }),
  11449. smalltalk.Symbol.klass);
  11450. smalltalk.addMethod(
  11451. "_lookup_",
  11452. smalltalk.method({
  11453. selector: "lookup:",
  11454. category: 'instance creation',
  11455. fn: function (aString){
  11456. var self=this;
  11457. return smalltalk.symbolFor(aString);;
  11458. ;
  11459. return self},
  11460. args: ["aString"],
  11461. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  11462. messageSends: [],
  11463. referencedClasses: []
  11464. }),
  11465. smalltalk.Symbol.klass);
  11466. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  11467. smalltalk.addMethod(
  11468. "__eq",
  11469. smalltalk.method({
  11470. selector: "=",
  11471. category: 'comparing',
  11472. fn: function (aCollection){
  11473. var self=this;
  11474. var $1;
  11475. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  11476. return smalltalk.send(self["@elements"],"__eq",[smalltalk.send(aCollection,"_asArray",[])]);
  11477. })]);
  11478. return $1;
  11479. },
  11480. args: ["aCollection"],
  11481. source: "= aCollection\x0a\x09^self class = aCollection class and: [\x0a\x09\x09elements = aCollection asArray]",
  11482. messageSends: ["and:", "=", "asArray", "class"],
  11483. referencedClasses: []
  11484. }),
  11485. smalltalk.Set);
  11486. smalltalk.addMethod(
  11487. "_add_",
  11488. smalltalk.method({
  11489. selector: "add:",
  11490. category: 'adding/removing',
  11491. fn: function (anObject){
  11492. var self=this;
  11493. var found;
  11494. for(var i=0; i < self['@elements'].length; i++) {
  11495. if(anObject == self['@elements'][i]) {
  11496. found = true;
  11497. break;
  11498. }
  11499. }
  11500. if(!found) {self['@elements'].push(anObject)}
  11501. ;
  11502. ;
  11503. return self},
  11504. args: ["anObject"],
  11505. 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>",
  11506. messageSends: [],
  11507. referencedClasses: []
  11508. }),
  11509. smalltalk.Set);
  11510. smalltalk.addMethod(
  11511. "_asArray",
  11512. smalltalk.method({
  11513. selector: "asArray",
  11514. category: 'converting',
  11515. fn: function (){
  11516. var self=this;
  11517. var $1;
  11518. $1=smalltalk.send(self["@elements"],"_copy",[]);
  11519. return $1;
  11520. },
  11521. args: [],
  11522. source: "asArray\x0a\x09^elements copy",
  11523. messageSends: ["copy"],
  11524. referencedClasses: []
  11525. }),
  11526. smalltalk.Set);
  11527. smalltalk.addMethod(
  11528. "_detect_ifNone_",
  11529. smalltalk.method({
  11530. selector: "detect:ifNone:",
  11531. category: 'enumerating',
  11532. fn: function (aBlock,anotherBlock){
  11533. var self=this;
  11534. var $1;
  11535. $1=smalltalk.send(self["@elements"],"_detect_ifNone_",[aBlock,anotherBlock]);
  11536. return $1;
  11537. },
  11538. args: ["aBlock", "anotherBlock"],
  11539. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  11540. messageSends: ["detect:ifNone:"],
  11541. referencedClasses: []
  11542. }),
  11543. smalltalk.Set);
  11544. smalltalk.addMethod(
  11545. "_do_",
  11546. smalltalk.method({
  11547. selector: "do:",
  11548. category: 'enumerating',
  11549. fn: function (aBlock){
  11550. var self=this;
  11551. smalltalk.send(self["@elements"],"_do_",[aBlock]);
  11552. return self},
  11553. args: ["aBlock"],
  11554. source: "do: aBlock\x0a\x09elements do: aBlock",
  11555. messageSends: ["do:"],
  11556. referencedClasses: []
  11557. }),
  11558. smalltalk.Set);
  11559. smalltalk.addMethod(
  11560. "_includes_",
  11561. smalltalk.method({
  11562. selector: "includes:",
  11563. category: 'testing',
  11564. fn: function (anObject){
  11565. var self=this;
  11566. var $1;
  11567. $1=smalltalk.send(self["@elements"],"_includes_",[anObject]);
  11568. return $1;
  11569. },
  11570. args: ["anObject"],
  11571. source: "includes: anObject\x0a\x09^elements includes: anObject",
  11572. messageSends: ["includes:"],
  11573. referencedClasses: []
  11574. }),
  11575. smalltalk.Set);
  11576. smalltalk.addMethod(
  11577. "_initialize",
  11578. smalltalk.method({
  11579. selector: "initialize",
  11580. category: 'initialization',
  11581. fn: function (){
  11582. var self=this;
  11583. smalltalk.send(self,"_initialize",[],smalltalk.Collection);
  11584. self["@elements"]=[];
  11585. return self},
  11586. args: [],
  11587. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  11588. messageSends: ["initialize"],
  11589. referencedClasses: []
  11590. }),
  11591. smalltalk.Set);
  11592. smalltalk.addMethod(
  11593. "_remove_",
  11594. smalltalk.method({
  11595. selector: "remove:",
  11596. category: 'adding/removing',
  11597. fn: function (anObject){
  11598. var self=this;
  11599. smalltalk.send(self["@elements"],"_remove_",[anObject]);
  11600. return self},
  11601. args: ["anObject"],
  11602. source: "remove: anObject\x0a\x09elements remove: anObject",
  11603. messageSends: ["remove:"],
  11604. referencedClasses: []
  11605. }),
  11606. smalltalk.Set);
  11607. smalltalk.addMethod(
  11608. "_select_",
  11609. smalltalk.method({
  11610. selector: "select:",
  11611. category: 'enumerating',
  11612. fn: function (aBlock){
  11613. var self=this;
  11614. var $1;
  11615. var collection;
  11616. collection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  11617. smalltalk.send(self,"_do_",[(function(each){
  11618. $1=smalltalk.send(aBlock,"_value_",[each]);
  11619. if(smalltalk.assert($1)){
  11620. return smalltalk.send(collection,"_add_",[each]);
  11621. };
  11622. })]);
  11623. return collection;
  11624. },
  11625. args: ["aBlock"],
  11626. 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",
  11627. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  11628. referencedClasses: []
  11629. }),
  11630. smalltalk.Set);
  11631. smalltalk.addMethod(
  11632. "_size",
  11633. smalltalk.method({
  11634. selector: "size",
  11635. category: 'accessing',
  11636. fn: function (){
  11637. var self=this;
  11638. var $1;
  11639. $1=smalltalk.send(self["@elements"],"_size",[]);
  11640. return $1;
  11641. },
  11642. args: [],
  11643. source: "size\x0a\x09^elements size",
  11644. messageSends: ["size"],
  11645. referencedClasses: []
  11646. }),
  11647. smalltalk.Set);
  11648. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  11649. smalltalk.addMethod(
  11650. "_back_",
  11651. smalltalk.method({
  11652. selector: "back:",
  11653. category: 'accessing',
  11654. fn: function (anObject){
  11655. var self=this;
  11656. smalltalk.send(self["@write"],"_add_",[anObject]);
  11657. return self},
  11658. args: ["anObject"],
  11659. source: "back: anObject\x0a\x09write add: anObject\x0a",
  11660. messageSends: ["add:"],
  11661. referencedClasses: []
  11662. }),
  11663. smalltalk.Queue);
  11664. smalltalk.addMethod(
  11665. "_front",
  11666. smalltalk.method({
  11667. selector: "front",
  11668. category: 'accessing',
  11669. fn: function (){
  11670. var self=this;
  11671. var $1;
  11672. $1=smalltalk.send(self,"_frontIfAbsent_",[(function(){
  11673. return smalltalk.send(self,"_error_",["Cannot read from empty Queue."]);
  11674. })]);
  11675. return $1;
  11676. },
  11677. args: [],
  11678. source: "front\x0a ^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.']\x0a",
  11679. messageSends: ["frontIfAbsent:", "error:"],
  11680. referencedClasses: []
  11681. }),
  11682. smalltalk.Queue);
  11683. smalltalk.addMethod(
  11684. "_frontIfAbsent_",
  11685. smalltalk.method({
  11686. selector: "frontIfAbsent:",
  11687. category: 'accessing',
  11688. fn: function (aBlock){
  11689. var self=this;
  11690. var $1,$2,$3;
  11691. var $early={};
  11692. try {
  11693. var result;
  11694. result=smalltalk.send(self["@read"],"_at_ifAbsent_",[self["@readIndex"],(function(){
  11695. $1=smalltalk.send(self["@write"],"_isEmpty",[]);
  11696. if(smalltalk.assert($1)){
  11697. $2=smalltalk.send(self["@readIndex"],"__gt",[(1)]);
  11698. if(smalltalk.assert($2)){
  11699. self["@read"]=[];
  11700. self["@read"];
  11701. self["@readIndex"]=(1);
  11702. self["@readIndex"];
  11703. };
  11704. $3=smalltalk.send(aBlock,"_value",[]);
  11705. throw $early=[$3];
  11706. };
  11707. self["@read"]=self["@write"];
  11708. self["@read"];
  11709. self["@readIndex"]=(1);
  11710. self["@readIndex"];
  11711. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  11712. self["@write"];
  11713. return smalltalk.send(self["@read"],"_first",[]);
  11714. })]);
  11715. smalltalk.send(self["@read"],"_at_put_",[self["@readIndex"],nil]);
  11716. self["@readIndex"]=smalltalk.send(self["@readIndex"],"__plus",[(1)]);
  11717. return result;
  11718. }
  11719. catch(e) {if(e===$early)return e[0]; throw e}
  11720. },
  11721. args: ["aBlock"],
  11722. source: "frontIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^aBlock value ].\x0a \x09read := write.\x0a \x09readIndex := 1.\x0a \x09write := OrderedCollection new.\x0a \x09read first ].\x0a read at: readIndex put: nil.\x0a readIndex := readIndex + 1.\x0a ^result\x0a",
  11723. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  11724. referencedClasses: ["OrderedCollection"]
  11725. }),
  11726. smalltalk.Queue);
  11727. smalltalk.addMethod(
  11728. "_initialize",
  11729. smalltalk.method({
  11730. selector: "initialize",
  11731. category: 'initialization',
  11732. fn: function (){
  11733. var self=this;
  11734. self["@read"]=[];
  11735. self["@readIndex"]=(1);
  11736. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  11737. return self},
  11738. args: [],
  11739. source: "initialize\x0a\x09read := #().\x0a readIndex := 1.\x0a write := OrderedCollection new",
  11740. messageSends: ["new"],
  11741. referencedClasses: ["OrderedCollection"]
  11742. }),
  11743. smalltalk.Queue);
  11744. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  11745. smalltalk.addMethod(
  11746. "_compile_",
  11747. smalltalk.method({
  11748. selector: "compile:",
  11749. category: 'evaluating',
  11750. fn: function (aString){
  11751. var self=this;
  11752. return self.compile(aString);
  11753. ;
  11754. return self},
  11755. args: ["aString"],
  11756. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  11757. messageSends: [],
  11758. referencedClasses: []
  11759. }),
  11760. smalltalk.RegularExpression);
  11761. smalltalk.addMethod(
  11762. "_exec_",
  11763. smalltalk.method({
  11764. selector: "exec:",
  11765. category: 'evaluating',
  11766. fn: function (aString){
  11767. var self=this;
  11768. return self.exec(aString) || nil;
  11769. ;
  11770. return self},
  11771. args: ["aString"],
  11772. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  11773. messageSends: [],
  11774. referencedClasses: []
  11775. }),
  11776. smalltalk.RegularExpression);
  11777. smalltalk.addMethod(
  11778. "_test_",
  11779. smalltalk.method({
  11780. selector: "test:",
  11781. category: 'evaluating',
  11782. fn: function (aString){
  11783. var self=this;
  11784. return self.test(aString);
  11785. ;
  11786. return self},
  11787. args: ["aString"],
  11788. source: "test: aString\x0a\x09<return self.test(aString)>",
  11789. messageSends: [],
  11790. referencedClasses: []
  11791. }),
  11792. smalltalk.RegularExpression);
  11793. smalltalk.addMethod(
  11794. "_fromString_",
  11795. smalltalk.method({
  11796. selector: "fromString:",
  11797. category: 'instance creation',
  11798. fn: function (aString){
  11799. var self=this;
  11800. var $1;
  11801. $1=smalltalk.send(self,"_fromString_flag_",[aString,""]);
  11802. return $1;
  11803. },
  11804. args: ["aString"],
  11805. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  11806. messageSends: ["fromString:flag:"],
  11807. referencedClasses: []
  11808. }),
  11809. smalltalk.RegularExpression.klass);
  11810. smalltalk.addMethod(
  11811. "_fromString_flag_",
  11812. smalltalk.method({
  11813. selector: "fromString:flag:",
  11814. category: 'instance creation',
  11815. fn: function (aString,anotherString){
  11816. var self=this;
  11817. return new RegExp(aString, anotherString);
  11818. ;
  11819. return self},
  11820. args: ["aString", "anotherString"],
  11821. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  11822. messageSends: [],
  11823. referencedClasses: []
  11824. }),
  11825. smalltalk.RegularExpression.klass);
  11826. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  11827. smalltalk.addMethod(
  11828. "_atEnd",
  11829. smalltalk.method({
  11830. selector: "atEnd",
  11831. category: 'testing',
  11832. fn: function (){
  11833. var self=this;
  11834. var $1;
  11835. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[smalltalk.send(self,"_size",[])]);
  11836. return $1;
  11837. },
  11838. args: [],
  11839. source: "atEnd\x0a\x09^self position = self size",
  11840. messageSends: ["=", "size", "position"],
  11841. referencedClasses: []
  11842. }),
  11843. smalltalk.Stream);
  11844. smalltalk.addMethod(
  11845. "_atStart",
  11846. smalltalk.method({
  11847. selector: "atStart",
  11848. category: 'testing',
  11849. fn: function (){
  11850. var self=this;
  11851. var $1;
  11852. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[(0)]);
  11853. return $1;
  11854. },
  11855. args: [],
  11856. source: "atStart\x0a\x09^self position = 0",
  11857. messageSends: ["=", "position"],
  11858. referencedClasses: []
  11859. }),
  11860. smalltalk.Stream);
  11861. smalltalk.addMethod(
  11862. "_close",
  11863. smalltalk.method({
  11864. selector: "close",
  11865. category: 'actions',
  11866. fn: function (){
  11867. var self=this;
  11868. return self},
  11869. args: [],
  11870. source: "close",
  11871. messageSends: [],
  11872. referencedClasses: []
  11873. }),
  11874. smalltalk.Stream);
  11875. smalltalk.addMethod(
  11876. "_collection",
  11877. smalltalk.method({
  11878. selector: "collection",
  11879. category: 'accessing',
  11880. fn: function (){
  11881. var self=this;
  11882. return self["@collection"];
  11883. },
  11884. args: [],
  11885. source: "collection\x0a\x09^collection",
  11886. messageSends: [],
  11887. referencedClasses: []
  11888. }),
  11889. smalltalk.Stream);
  11890. smalltalk.addMethod(
  11891. "_contents",
  11892. smalltalk.method({
  11893. selector: "contents",
  11894. category: 'accessing',
  11895. fn: function (){
  11896. var self=this;
  11897. var $1;
  11898. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_copyFrom_to_",[(1),smalltalk.send(self,"_streamSize",[])]);
  11899. return $1;
  11900. },
  11901. args: [],
  11902. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  11903. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  11904. referencedClasses: []
  11905. }),
  11906. smalltalk.Stream);
  11907. smalltalk.addMethod(
  11908. "_do_",
  11909. smalltalk.method({
  11910. selector: "do:",
  11911. category: 'enumerating',
  11912. fn: function (aBlock){
  11913. var self=this;
  11914. smalltalk.send((function(){
  11915. return smalltalk.send(self,"_atEnd",[]);
  11916. }),"_whileFalse_",[(function(){
  11917. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_next",[])]);
  11918. })]);
  11919. return self},
  11920. args: ["aBlock"],
  11921. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  11922. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  11923. referencedClasses: []
  11924. }),
  11925. smalltalk.Stream);
  11926. smalltalk.addMethod(
  11927. "_flush",
  11928. smalltalk.method({
  11929. selector: "flush",
  11930. category: 'actions',
  11931. fn: function (){
  11932. var self=this;
  11933. return self},
  11934. args: [],
  11935. source: "flush",
  11936. messageSends: [],
  11937. referencedClasses: []
  11938. }),
  11939. smalltalk.Stream);
  11940. smalltalk.addMethod(
  11941. "_isEmpty",
  11942. smalltalk.method({
  11943. selector: "isEmpty",
  11944. category: 'testing',
  11945. fn: function (){
  11946. var self=this;
  11947. var $1;
  11948. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  11949. return $1;
  11950. },
  11951. args: [],
  11952. source: "isEmpty\x0a\x09^self size = 0",
  11953. messageSends: ["=", "size"],
  11954. referencedClasses: []
  11955. }),
  11956. smalltalk.Stream);
  11957. smalltalk.addMethod(
  11958. "_next",
  11959. smalltalk.method({
  11960. selector: "next",
  11961. category: 'reading',
  11962. fn: function (){
  11963. var self=this;
  11964. var $2,$1;
  11965. $2=smalltalk.send(self,"_atEnd",[]);
  11966. if(smalltalk.assert($2)){
  11967. $1=nil;
  11968. } else {
  11969. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  11970. $1=smalltalk.send(self["@collection"],"_at_",[smalltalk.send(self,"_position",[])]);
  11971. };
  11972. return $1;
  11973. },
  11974. args: [],
  11975. 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]",
  11976. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  11977. referencedClasses: []
  11978. }),
  11979. smalltalk.Stream);
  11980. smalltalk.addMethod(
  11981. "_next_",
  11982. smalltalk.method({
  11983. selector: "next:",
  11984. category: 'reading',
  11985. fn: function (anInteger){
  11986. var self=this;
  11987. var $1;
  11988. var tempCollection;
  11989. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  11990. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  11991. $1=smalltalk.send(self,"_atEnd",[]);
  11992. if(! smalltalk.assert($1)){
  11993. return smalltalk.send(tempCollection,"_add_",[smalltalk.send(self,"_next",[])]);
  11994. };
  11995. })]);
  11996. return tempCollection;
  11997. },
  11998. args: ["anInteger"],
  11999. 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",
  12000. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  12001. referencedClasses: []
  12002. }),
  12003. smalltalk.Stream);
  12004. smalltalk.addMethod(
  12005. "_nextPut_",
  12006. smalltalk.method({
  12007. selector: "nextPut:",
  12008. category: 'writing',
  12009. fn: function (anObject){
  12010. var self=this;
  12011. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  12012. smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_put_",[smalltalk.send(self,"_position",[]),anObject]);
  12013. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  12014. return self},
  12015. args: ["anObject"],
  12016. 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)",
  12017. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  12018. referencedClasses: []
  12019. }),
  12020. smalltalk.Stream);
  12021. smalltalk.addMethod(
  12022. "_nextPutAll_",
  12023. smalltalk.method({
  12024. selector: "nextPutAll:",
  12025. category: 'writing',
  12026. fn: function (aCollection){
  12027. var self=this;
  12028. smalltalk.send(aCollection,"_do_",[(function(each){
  12029. return smalltalk.send(self,"_nextPut_",[each]);
  12030. })]);
  12031. return self},
  12032. args: ["aCollection"],
  12033. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  12034. messageSends: ["do:", "nextPut:"],
  12035. referencedClasses: []
  12036. }),
  12037. smalltalk.Stream);
  12038. smalltalk.addMethod(
  12039. "_peek",
  12040. smalltalk.method({
  12041. selector: "peek",
  12042. category: 'reading',
  12043. fn: function (){
  12044. var self=this;
  12045. var $2,$1;
  12046. $2=smalltalk.send(self,"_atEnd",[]);
  12047. if(! smalltalk.assert($2)){
  12048. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  12049. };
  12050. return $1;
  12051. },
  12052. args: [],
  12053. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  12054. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  12055. referencedClasses: []
  12056. }),
  12057. smalltalk.Stream);
  12058. smalltalk.addMethod(
  12059. "_position",
  12060. smalltalk.method({
  12061. selector: "position",
  12062. category: 'accessing',
  12063. fn: function (){
  12064. var self=this;
  12065. var $1;
  12066. if(($receiver = self["@position"]) == nil || $receiver == undefined){
  12067. self["@position"]=(0);
  12068. $1=self["@position"];
  12069. } else {
  12070. $1=self["@position"];
  12071. };
  12072. return $1;
  12073. },
  12074. args: [],
  12075. source: "position\x0a\x09^position ifNil: [position := 0]",
  12076. messageSends: ["ifNil:"],
  12077. referencedClasses: []
  12078. }),
  12079. smalltalk.Stream);
  12080. smalltalk.addMethod(
  12081. "_position_",
  12082. smalltalk.method({
  12083. selector: "position:",
  12084. category: 'accessing',
  12085. fn: function (anInteger){
  12086. var self=this;
  12087. self["@position"]=anInteger;
  12088. return self},
  12089. args: ["anInteger"],
  12090. source: "position: anInteger\x0a\x09position := anInteger",
  12091. messageSends: [],
  12092. referencedClasses: []
  12093. }),
  12094. smalltalk.Stream);
  12095. smalltalk.addMethod(
  12096. "_reset",
  12097. smalltalk.method({
  12098. selector: "reset",
  12099. category: 'actions',
  12100. fn: function (){
  12101. var self=this;
  12102. smalltalk.send(self,"_position_",[(0)]);
  12103. return self},
  12104. args: [],
  12105. source: "reset\x0a\x09self position: 0",
  12106. messageSends: ["position:"],
  12107. referencedClasses: []
  12108. }),
  12109. smalltalk.Stream);
  12110. smalltalk.addMethod(
  12111. "_resetContents",
  12112. smalltalk.method({
  12113. selector: "resetContents",
  12114. category: 'actions',
  12115. fn: function (){
  12116. var self=this;
  12117. smalltalk.send(self,"_reset",[]);
  12118. smalltalk.send(self,"_setStreamSize_",[(0)]);
  12119. return self},
  12120. args: [],
  12121. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  12122. messageSends: ["reset", "setStreamSize:"],
  12123. referencedClasses: []
  12124. }),
  12125. smalltalk.Stream);
  12126. smalltalk.addMethod(
  12127. "_setCollection_",
  12128. smalltalk.method({
  12129. selector: "setCollection:",
  12130. category: 'accessing',
  12131. fn: function (aCollection){
  12132. var self=this;
  12133. self["@collection"]=aCollection;
  12134. return self},
  12135. args: ["aCollection"],
  12136. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  12137. messageSends: [],
  12138. referencedClasses: []
  12139. }),
  12140. smalltalk.Stream);
  12141. smalltalk.addMethod(
  12142. "_setStreamSize_",
  12143. smalltalk.method({
  12144. selector: "setStreamSize:",
  12145. category: 'accessing',
  12146. fn: function (anInteger){
  12147. var self=this;
  12148. self["@streamSize"]=anInteger;
  12149. return self},
  12150. args: ["anInteger"],
  12151. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  12152. messageSends: [],
  12153. referencedClasses: []
  12154. }),
  12155. smalltalk.Stream);
  12156. smalltalk.addMethod(
  12157. "_setToEnd",
  12158. smalltalk.method({
  12159. selector: "setToEnd",
  12160. category: 'positioning',
  12161. fn: function (){
  12162. var self=this;
  12163. smalltalk.send(self,"_position_",[smalltalk.send(self,"_size",[])]);
  12164. return self},
  12165. args: [],
  12166. source: "setToEnd\x0a\x09self position: self size",
  12167. messageSends: ["position:", "size"],
  12168. referencedClasses: []
  12169. }),
  12170. smalltalk.Stream);
  12171. smalltalk.addMethod(
  12172. "_size",
  12173. smalltalk.method({
  12174. selector: "size",
  12175. category: 'accessing',
  12176. fn: function (){
  12177. var self=this;
  12178. var $1;
  12179. $1=smalltalk.send(self,"_streamSize",[]);
  12180. return $1;
  12181. },
  12182. args: [],
  12183. source: "size\x0a\x09^self streamSize",
  12184. messageSends: ["streamSize"],
  12185. referencedClasses: []
  12186. }),
  12187. smalltalk.Stream);
  12188. smalltalk.addMethod(
  12189. "_skip_",
  12190. smalltalk.method({
  12191. selector: "skip:",
  12192. category: 'positioning',
  12193. fn: function (anInteger){
  12194. var self=this;
  12195. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[anInteger]),"_min_max_",[smalltalk.send(self,"_size",[]),(0)])]);
  12196. return self},
  12197. args: ["anInteger"],
  12198. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  12199. messageSends: ["position:", "min:max:", "size", "+", "position"],
  12200. referencedClasses: []
  12201. }),
  12202. smalltalk.Stream);
  12203. smalltalk.addMethod(
  12204. "_streamSize",
  12205. smalltalk.method({
  12206. selector: "streamSize",
  12207. category: 'accessing',
  12208. fn: function (){
  12209. var self=this;
  12210. return self["@streamSize"];
  12211. },
  12212. args: [],
  12213. source: "streamSize\x0a\x09^streamSize",
  12214. messageSends: [],
  12215. referencedClasses: []
  12216. }),
  12217. smalltalk.Stream);
  12218. smalltalk.addMethod(
  12219. "_on_",
  12220. smalltalk.method({
  12221. selector: "on:",
  12222. category: 'instance creation',
  12223. fn: function (aCollection){
  12224. var self=this;
  12225. var $2,$3,$1;
  12226. $2=smalltalk.send(self,"_new",[]);
  12227. smalltalk.send($2,"_setCollection_",[aCollection]);
  12228. smalltalk.send($2,"_setStreamSize_",[smalltalk.send(aCollection,"_size",[])]);
  12229. $3=smalltalk.send($2,"_yourself",[]);
  12230. $1=$3;
  12231. return $1;
  12232. },
  12233. args: ["aCollection"],
  12234. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12235. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  12236. referencedClasses: []
  12237. }),
  12238. smalltalk.Stream.klass);
  12239. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  12240. smalltalk.addMethod(
  12241. "_cr",
  12242. smalltalk.method({
  12243. selector: "cr",
  12244. category: 'writing',
  12245. fn: function (){
  12246. var self=this;
  12247. var $1;
  12248. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  12249. return $1;
  12250. },
  12251. args: [],
  12252. source: "cr\x0a\x09^self nextPutAll: String cr",
  12253. messageSends: ["nextPutAll:", "cr"],
  12254. referencedClasses: ["String"]
  12255. }),
  12256. smalltalk.StringStream);
  12257. smalltalk.addMethod(
  12258. "_crlf",
  12259. smalltalk.method({
  12260. selector: "crlf",
  12261. category: 'writing',
  12262. fn: function (){
  12263. var self=this;
  12264. var $1;
  12265. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_crlf",[])]);
  12266. return $1;
  12267. },
  12268. args: [],
  12269. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  12270. messageSends: ["nextPutAll:", "crlf"],
  12271. referencedClasses: ["String"]
  12272. }),
  12273. smalltalk.StringStream);
  12274. smalltalk.addMethod(
  12275. "_lf",
  12276. smalltalk.method({
  12277. selector: "lf",
  12278. category: 'writing',
  12279. fn: function (){
  12280. var self=this;
  12281. var $1;
  12282. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_lf",[])]);
  12283. return $1;
  12284. },
  12285. args: [],
  12286. source: "lf\x0a\x09^self nextPutAll: String lf",
  12287. messageSends: ["nextPutAll:", "lf"],
  12288. referencedClasses: ["String"]
  12289. }),
  12290. smalltalk.StringStream);
  12291. smalltalk.addMethod(
  12292. "_next_",
  12293. smalltalk.method({
  12294. selector: "next:",
  12295. category: 'reading',
  12296. fn: function (anInteger){
  12297. var self=this;
  12298. var $1;
  12299. var tempCollection;
  12300. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  12301. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  12302. $1=smalltalk.send(self,"_atEnd",[]);
  12303. if(! smalltalk.assert($1)){
  12304. tempCollection=smalltalk.send(tempCollection,"__comma",[smalltalk.send(self,"_next",[])]);
  12305. return tempCollection;
  12306. };
  12307. })]);
  12308. return tempCollection;
  12309. },
  12310. args: ["anInteger"],
  12311. 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",
  12312. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  12313. referencedClasses: []
  12314. }),
  12315. smalltalk.StringStream);
  12316. smalltalk.addMethod(
  12317. "_nextPut_",
  12318. smalltalk.method({
  12319. selector: "nextPut:",
  12320. category: 'writing',
  12321. fn: function (aString){
  12322. var self=this;
  12323. smalltalk.send(self,"_nextPutAll_",[aString]);
  12324. return self},
  12325. args: ["aString"],
  12326. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  12327. messageSends: ["nextPutAll:"],
  12328. referencedClasses: []
  12329. }),
  12330. smalltalk.StringStream);
  12331. smalltalk.addMethod(
  12332. "_nextPutAll_",
  12333. smalltalk.method({
  12334. selector: "nextPutAll:",
  12335. category: 'writing',
  12336. fn: function (aString){
  12337. var self=this;
  12338. 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_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)]),"__plus",[smalltalk.send(aString,"_size",[])]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[])])])]);
  12339. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[smalltalk.send(aString,"_size",[])])]);
  12340. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  12341. return self},
  12342. args: ["aString"],
  12343. 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)",
  12344. messageSends: ["setCollection:", ",", "copyFrom:to:", "+", "size", "position", "collection", "position:", "setStreamSize:", "max:", "streamSize"],
  12345. referencedClasses: []
  12346. }),
  12347. smalltalk.StringStream);
  12348. smalltalk.addMethod(
  12349. "_space",
  12350. smalltalk.method({
  12351. selector: "space",
  12352. category: 'writing',
  12353. fn: function (){
  12354. var self=this;
  12355. smalltalk.send(self,"_nextPut_",[" "]);
  12356. return self},
  12357. args: [],
  12358. source: "space\x0a\x09self nextPut: ' '",
  12359. messageSends: ["nextPut:"],
  12360. referencedClasses: []
  12361. }),
  12362. smalltalk.StringStream);
  12363. smalltalk.addPackage('Kernel-Exceptions', {});
  12364. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  12365. smalltalk.addMethod(
  12366. "_context",
  12367. smalltalk.method({
  12368. selector: "context",
  12369. category: 'accessing',
  12370. fn: function (){
  12371. var self=this;
  12372. return self.context;
  12373. ;
  12374. return self},
  12375. args: [],
  12376. source: "context\x0a\x09<return self.context>",
  12377. messageSends: [],
  12378. referencedClasses: []
  12379. }),
  12380. smalltalk.Error);
  12381. smalltalk.addMethod(
  12382. "_isSmalltalkError",
  12383. smalltalk.method({
  12384. selector: "isSmalltalkError",
  12385. category: 'testing',
  12386. fn: function (){
  12387. var self=this;
  12388. return self.smalltalkError === true;
  12389. ;
  12390. return self},
  12391. args: [],
  12392. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  12393. messageSends: [],
  12394. referencedClasses: []
  12395. }),
  12396. smalltalk.Error);
  12397. smalltalk.addMethod(
  12398. "_jsStack",
  12399. smalltalk.method({
  12400. selector: "jsStack",
  12401. category: 'accessing',
  12402. fn: function (){
  12403. var self=this;
  12404. return self.stack;
  12405. ;
  12406. return self},
  12407. args: [],
  12408. source: "jsStack\x0a\x09<return self.stack>",
  12409. messageSends: [],
  12410. referencedClasses: []
  12411. }),
  12412. smalltalk.Error);
  12413. smalltalk.addMethod(
  12414. "_messageText",
  12415. smalltalk.method({
  12416. selector: "messageText",
  12417. category: 'accessing',
  12418. fn: function (){
  12419. var self=this;
  12420. return self["@messageText"];
  12421. },
  12422. args: [],
  12423. source: "messageText\x0a\x09^messageText",
  12424. messageSends: [],
  12425. referencedClasses: []
  12426. }),
  12427. smalltalk.Error);
  12428. smalltalk.addMethod(
  12429. "_messageText_",
  12430. smalltalk.method({
  12431. selector: "messageText:",
  12432. category: 'accessing',
  12433. fn: function (aString){
  12434. var self=this;
  12435. self["@messageText"]=aString;
  12436. return self},
  12437. args: ["aString"],
  12438. source: "messageText: aString\x0a\x09messageText := aString",
  12439. messageSends: [],
  12440. referencedClasses: []
  12441. }),
  12442. smalltalk.Error);
  12443. smalltalk.addMethod(
  12444. "_signal",
  12445. smalltalk.method({
  12446. selector: "signal",
  12447. category: 'signaling',
  12448. fn: function (){
  12449. var self=this;
  12450. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  12451. ;
  12452. return self},
  12453. args: [],
  12454. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  12455. messageSends: [],
  12456. referencedClasses: []
  12457. }),
  12458. smalltalk.Error);
  12459. smalltalk.addMethod(
  12460. "_signal_",
  12461. smalltalk.method({
  12462. selector: "signal:",
  12463. category: 'signaling',
  12464. fn: function (aString){
  12465. var self=this;
  12466. smalltalk.send(self,"_messageText_",[aString]);
  12467. smalltalk.send(self,"_signal",[]);
  12468. return self},
  12469. args: ["aString"],
  12470. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  12471. messageSends: ["messageText:", "signal"],
  12472. referencedClasses: []
  12473. }),
  12474. smalltalk.Error);
  12475. smalltalk.addMethod(
  12476. "_signal",
  12477. smalltalk.method({
  12478. selector: "signal",
  12479. category: 'instance creation',
  12480. fn: function (){
  12481. var self=this;
  12482. var $1;
  12483. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal",[]);
  12484. return $1;
  12485. },
  12486. args: [],
  12487. source: "signal\x0a\x09^self new signal",
  12488. messageSends: ["signal", "new"],
  12489. referencedClasses: []
  12490. }),
  12491. smalltalk.Error.klass);
  12492. smalltalk.addMethod(
  12493. "_signal_",
  12494. smalltalk.method({
  12495. selector: "signal:",
  12496. category: 'instance creation',
  12497. fn: function (aString){
  12498. var self=this;
  12499. var $1;
  12500. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal_",[aString]);
  12501. return $1;
  12502. },
  12503. args: ["aString"],
  12504. source: "signal: aString\x0a\x09 ^self new\x0a\x09\x09signal: aString",
  12505. messageSends: ["signal:", "new"],
  12506. referencedClasses: []
  12507. }),
  12508. smalltalk.Error.klass);
  12509. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  12510. smalltalk.addMethod(
  12511. "_message",
  12512. smalltalk.method({
  12513. selector: "message",
  12514. category: 'accessing',
  12515. fn: function (){
  12516. var self=this;
  12517. return self["@message"];
  12518. },
  12519. args: [],
  12520. source: "message\x0a\x09^message",
  12521. messageSends: [],
  12522. referencedClasses: []
  12523. }),
  12524. smalltalk.MessageNotUnderstood);
  12525. smalltalk.addMethod(
  12526. "_message_",
  12527. smalltalk.method({
  12528. selector: "message:",
  12529. category: 'accessing',
  12530. fn: function (aMessage){
  12531. var self=this;
  12532. self["@message"]=aMessage;
  12533. return self},
  12534. args: ["aMessage"],
  12535. source: "message: aMessage\x0a\x09message := aMessage",
  12536. messageSends: [],
  12537. referencedClasses: []
  12538. }),
  12539. smalltalk.MessageNotUnderstood);
  12540. smalltalk.addMethod(
  12541. "_messageText",
  12542. smalltalk.method({
  12543. selector: "messageText",
  12544. category: 'accessing',
  12545. fn: function (){
  12546. var self=this;
  12547. var $1;
  12548. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_asString",[]),"__comma",[" does not understand #"]),"__comma",[smalltalk.send(smalltalk.send(self,"_message",[]),"_selector",[])]);
  12549. return $1;
  12550. },
  12551. args: [],
  12552. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  12553. messageSends: [",", "selector", "message", "asString", "receiver"],
  12554. referencedClasses: []
  12555. }),
  12556. smalltalk.MessageNotUnderstood);
  12557. smalltalk.addMethod(
  12558. "_receiver",
  12559. smalltalk.method({
  12560. selector: "receiver",
  12561. category: 'accessing',
  12562. fn: function (){
  12563. var self=this;
  12564. return self["@receiver"];
  12565. },
  12566. args: [],
  12567. source: "receiver\x0a\x09^receiver",
  12568. messageSends: [],
  12569. referencedClasses: []
  12570. }),
  12571. smalltalk.MessageNotUnderstood);
  12572. smalltalk.addMethod(
  12573. "_receiver_",
  12574. smalltalk.method({
  12575. selector: "receiver:",
  12576. category: 'accessing',
  12577. fn: function (anObject){
  12578. var self=this;
  12579. self["@receiver"]=anObject;
  12580. return self},
  12581. args: ["anObject"],
  12582. source: "receiver: anObject\x0a\x09receiver := anObject",
  12583. messageSends: [],
  12584. referencedClasses: []
  12585. }),
  12586. smalltalk.MessageNotUnderstood);
  12587. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  12588. smalltalk.addMethod(
  12589. "_object",
  12590. smalltalk.method({
  12591. selector: "object",
  12592. category: 'accessing',
  12593. fn: function (){
  12594. var self=this;
  12595. return self["@object"];
  12596. },
  12597. args: [],
  12598. source: "object\x0a\x09^ object",
  12599. messageSends: [],
  12600. referencedClasses: []
  12601. }),
  12602. smalltalk.NonBooleanReceiver);
  12603. smalltalk.addMethod(
  12604. "_object_",
  12605. smalltalk.method({
  12606. selector: "object:",
  12607. category: 'accessing',
  12608. fn: function (anObject){
  12609. var self=this;
  12610. self["@object"]=anObject;
  12611. return self},
  12612. args: ["anObject"],
  12613. source: "object: anObject\x0a\x09object := anObject",
  12614. messageSends: [],
  12615. referencedClasses: []
  12616. }),
  12617. smalltalk.NonBooleanReceiver);
  12618. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  12619. smalltalk.addMethod(
  12620. "_handleError_",
  12621. smalltalk.method({
  12622. selector: "handleError:",
  12623. category: 'error handling',
  12624. fn: function (anError){
  12625. var self=this;
  12626. var $1;
  12627. $1=smalltalk.send(anError,"_context",[]);
  12628. if(($receiver = $1) == nil || $receiver == undefined){
  12629. $1;
  12630. } else {
  12631. smalltalk.send(self,"_logErrorContext_",[smalltalk.send(anError,"_context",[])]);
  12632. };
  12633. smalltalk.send(self,"_logError_",[anError]);
  12634. return self},
  12635. args: ["anError"],
  12636. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  12637. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  12638. referencedClasses: []
  12639. }),
  12640. smalltalk.ErrorHandler);
  12641. smalltalk.addMethod(
  12642. "_log_",
  12643. smalltalk.method({
  12644. selector: "log:",
  12645. category: 'private',
  12646. fn: function (aString){
  12647. var self=this;
  12648. smalltalk.send(console,"_log_",[aString]);
  12649. return self},
  12650. args: ["aString"],
  12651. source: "log: aString\x0a\x09console log: aString",
  12652. messageSends: ["log:"],
  12653. referencedClasses: []
  12654. }),
  12655. smalltalk.ErrorHandler);
  12656. smalltalk.addMethod(
  12657. "_logContext_",
  12658. smalltalk.method({
  12659. selector: "logContext:",
  12660. category: 'private',
  12661. fn: function (aContext){
  12662. var self=this;
  12663. var $1;
  12664. $1=smalltalk.send(aContext,"_home",[]);
  12665. if(($receiver = $1) == nil || $receiver == undefined){
  12666. $1;
  12667. } else {
  12668. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  12669. };
  12670. smalltalk.send(self,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext,"_receiver",[]),"_asString",[]),"__comma",[">>"]),"__comma",[smalltalk.send(aContext,"_selector",[])])]);
  12671. return self},
  12672. args: ["aContext"],
  12673. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector",
  12674. messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "selector", "asString", "receiver"],
  12675. referencedClasses: []
  12676. }),
  12677. smalltalk.ErrorHandler);
  12678. smalltalk.addMethod(
  12679. "_logError_",
  12680. smalltalk.method({
  12681. selector: "logError:",
  12682. category: 'private',
  12683. fn: function (anError){
  12684. var self=this;
  12685. smalltalk.send(self,"_log_",[smalltalk.send(anError,"_messageText",[])]);
  12686. return self},
  12687. args: ["anError"],
  12688. source: "logError: anError\x0a\x09self log: anError messageText",
  12689. messageSends: ["log:", "messageText"],
  12690. referencedClasses: []
  12691. }),
  12692. smalltalk.ErrorHandler);
  12693. smalltalk.addMethod(
  12694. "_logErrorContext_",
  12695. smalltalk.method({
  12696. selector: "logErrorContext:",
  12697. category: 'private',
  12698. fn: function (aContext){
  12699. var self=this;
  12700. var $1;
  12701. if(($receiver = aContext) == nil || $receiver == undefined){
  12702. aContext;
  12703. } else {
  12704. $1=smalltalk.send(aContext,"_home",[]);
  12705. if(($receiver = $1) == nil || $receiver == undefined){
  12706. $1;
  12707. } else {
  12708. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  12709. };
  12710. };
  12711. return self},
  12712. args: ["aContext"],
  12713. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  12714. messageSends: ["ifNotNil:", "logContext:", "home"],
  12715. referencedClasses: []
  12716. }),
  12717. smalltalk.ErrorHandler);
  12718. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  12719. smalltalk.addMethod(
  12720. "_current",
  12721. smalltalk.method({
  12722. selector: "current",
  12723. category: 'accessing',
  12724. fn: function (){
  12725. var self=this;
  12726. var $1;
  12727. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  12728. self["@current"]=smalltalk.send(self,"_new",[]);
  12729. $1=self["@current"];
  12730. } else {
  12731. $1=self["@current"];
  12732. };
  12733. return $1;
  12734. },
  12735. args: [],
  12736. source: "current\x0a\x09^current ifNil: [current := self new]",
  12737. messageSends: ["ifNil:", "new"],
  12738. referencedClasses: []
  12739. }),
  12740. smalltalk.ErrorHandler.klass);
  12741. smalltalk.addMethod(
  12742. "_initialize",
  12743. smalltalk.method({
  12744. selector: "initialize",
  12745. category: 'initialization',
  12746. fn: function (){
  12747. var self=this;
  12748. smalltalk.send(self,"_register",[]);
  12749. return self},
  12750. args: [],
  12751. source: "initialize\x0a\x09self register",
  12752. messageSends: ["register"],
  12753. referencedClasses: []
  12754. }),
  12755. smalltalk.ErrorHandler.klass);
  12756. smalltalk.addMethod(
  12757. "_register",
  12758. smalltalk.method({
  12759. selector: "register",
  12760. category: 'initialization',
  12761. fn: function (){
  12762. var self=this;
  12763. smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_setCurrent_",[smalltalk.send(self,"_new",[])]);
  12764. return self},
  12765. args: [],
  12766. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  12767. messageSends: ["setCurrent:", "new"],
  12768. referencedClasses: ["ErrorHandler"]
  12769. }),
  12770. smalltalk.ErrorHandler.klass);
  12771. smalltalk.addMethod(
  12772. "_setCurrent_",
  12773. smalltalk.method({
  12774. selector: "setCurrent:",
  12775. category: 'accessing',
  12776. fn: function (anHandler){
  12777. var self=this;
  12778. self["@current"]=anHandler;
  12779. return self},
  12780. args: ["anHandler"],
  12781. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  12782. messageSends: [],
  12783. referencedClasses: []
  12784. }),
  12785. smalltalk.ErrorHandler.klass);
  12786. smalltalk.addPackage('Kernel-Transcript', {});
  12787. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  12788. smalltalk.addMethod(
  12789. "_clear",
  12790. smalltalk.method({
  12791. selector: "clear",
  12792. category: 'printing',
  12793. fn: function (){
  12794. var self=this;
  12795. return self},
  12796. args: [],
  12797. source: "clear\x0a\x09\x22no op\x22",
  12798. messageSends: [],
  12799. referencedClasses: []
  12800. }),
  12801. smalltalk.ConsoleTranscript);
  12802. smalltalk.addMethod(
  12803. "_cr",
  12804. smalltalk.method({
  12805. selector: "cr",
  12806. category: 'printing',
  12807. fn: function (){
  12808. var self=this;
  12809. return self},
  12810. args: [],
  12811. source: "cr\x0a\x09\x22no op\x22",
  12812. messageSends: [],
  12813. referencedClasses: []
  12814. }),
  12815. smalltalk.ConsoleTranscript);
  12816. smalltalk.addMethod(
  12817. "_open",
  12818. smalltalk.method({
  12819. selector: "open",
  12820. category: 'actions',
  12821. fn: function (){
  12822. var self=this;
  12823. return self},
  12824. args: [],
  12825. source: "open",
  12826. messageSends: [],
  12827. referencedClasses: []
  12828. }),
  12829. smalltalk.ConsoleTranscript);
  12830. smalltalk.addMethod(
  12831. "_show_",
  12832. smalltalk.method({
  12833. selector: "show:",
  12834. category: 'printing',
  12835. fn: function (anObject){
  12836. var self=this;
  12837. var string;
  12838. string=smalltalk.send(anObject,"_asString",[]);
  12839. console.log(String(string));
  12840. ;
  12841. return self},
  12842. args: ["anObject"],
  12843. source: "show: anObject\x0a\x09| string |\x0a\x09string := anObject asString.\x0a\x09<console.log(String(string))>",
  12844. messageSends: ["asString"],
  12845. referencedClasses: []
  12846. }),
  12847. smalltalk.ConsoleTranscript);
  12848. smalltalk.addMethod(
  12849. "_initialize",
  12850. smalltalk.method({
  12851. selector: "initialize",
  12852. category: 'initialization',
  12853. fn: function (){
  12854. var self=this;
  12855. smalltalk.send((smalltalk.Transcript || Transcript),"_register_",[smalltalk.send(self,"_new",[])]);
  12856. return self},
  12857. args: [],
  12858. source: "initialize\x0a\x09Transcript register: self new",
  12859. messageSends: ["register:", "new"],
  12860. referencedClasses: ["Transcript"]
  12861. }),
  12862. smalltalk.ConsoleTranscript.klass);
  12863. smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  12864. smalltalk.Transcript.klass.iVarNames = ['current'];
  12865. smalltalk.addMethod(
  12866. "_clear",
  12867. smalltalk.method({
  12868. selector: "clear",
  12869. category: 'printing',
  12870. fn: function (){
  12871. var self=this;
  12872. smalltalk.send(smalltalk.send(self,"_current",[]),"_clear",[]);
  12873. return self},
  12874. args: [],
  12875. source: "clear\x0a self current clear",
  12876. messageSends: ["clear", "current"],
  12877. referencedClasses: []
  12878. }),
  12879. smalltalk.Transcript.klass);
  12880. smalltalk.addMethod(
  12881. "_cr",
  12882. smalltalk.method({
  12883. selector: "cr",
  12884. category: 'printing',
  12885. fn: function (){
  12886. var self=this;
  12887. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  12888. return self},
  12889. args: [],
  12890. source: "cr\x0a self current show: String cr",
  12891. messageSends: ["show:", "cr", "current"],
  12892. referencedClasses: ["String"]
  12893. }),
  12894. smalltalk.Transcript.klass);
  12895. smalltalk.addMethod(
  12896. "_current",
  12897. smalltalk.method({
  12898. selector: "current",
  12899. category: 'instance creation',
  12900. fn: function (){
  12901. var self=this;
  12902. return self["@current"];
  12903. },
  12904. args: [],
  12905. source: "current\x0a ^current",
  12906. messageSends: [],
  12907. referencedClasses: []
  12908. }),
  12909. smalltalk.Transcript.klass);
  12910. smalltalk.addMethod(
  12911. "_new",
  12912. smalltalk.method({
  12913. selector: "new",
  12914. category: 'instance creation',
  12915. fn: function (){
  12916. var self=this;
  12917. smalltalk.send(self,"_shouldNotImplement",[]);
  12918. return self},
  12919. args: [],
  12920. source: "new\x0a self shouldNotImplement",
  12921. messageSends: ["shouldNotImplement"],
  12922. referencedClasses: []
  12923. }),
  12924. smalltalk.Transcript.klass);
  12925. smalltalk.addMethod(
  12926. "_open",
  12927. smalltalk.method({
  12928. selector: "open",
  12929. category: 'instance creation',
  12930. fn: function (){
  12931. var self=this;
  12932. smalltalk.send(smalltalk.send(self,"_current",[]),"_open",[]);
  12933. return self},
  12934. args: [],
  12935. source: "open\x0a self current open",
  12936. messageSends: ["open", "current"],
  12937. referencedClasses: []
  12938. }),
  12939. smalltalk.Transcript.klass);
  12940. smalltalk.addMethod(
  12941. "_register_",
  12942. smalltalk.method({
  12943. selector: "register:",
  12944. category: 'instance creation',
  12945. fn: function (aTranscript){
  12946. var self=this;
  12947. self["@current"]=aTranscript;
  12948. return self},
  12949. args: ["aTranscript"],
  12950. source: "register: aTranscript\x0a\x09current := aTranscript",
  12951. messageSends: [],
  12952. referencedClasses: []
  12953. }),
  12954. smalltalk.Transcript.klass);
  12955. smalltalk.addMethod(
  12956. "_show_",
  12957. smalltalk.method({
  12958. selector: "show:",
  12959. category: 'printing',
  12960. fn: function (anObject){
  12961. var self=this;
  12962. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[anObject]);
  12963. return self},
  12964. args: ["anObject"],
  12965. source: "show: anObject\x0a self current show: anObject",
  12966. messageSends: ["show:", "current"],
  12967. referencedClasses: []
  12968. }),
  12969. smalltalk.Transcript.klass);
  12970. smalltalk.addPackage('Kernel-Announcements', {});
  12971. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
  12972. smalltalk.addMethod(
  12973. "_announcementClass",
  12974. smalltalk.method({
  12975. selector: "announcementClass",
  12976. category: 'accessing',
  12977. fn: function (){
  12978. var self=this;
  12979. return self["@announcementClass"];
  12980. },
  12981. args: [],
  12982. source: "announcementClass\x0a\x09^announcementClass",
  12983. messageSends: [],
  12984. referencedClasses: []
  12985. }),
  12986. smalltalk.AnnouncementSubscription);
  12987. smalltalk.addMethod(
  12988. "_announcementClass_",
  12989. smalltalk.method({
  12990. selector: "announcementClass:",
  12991. category: 'accessing',
  12992. fn: function (aClass){
  12993. var self=this;
  12994. self["@announcementClass"]=aClass;
  12995. return self},
  12996. args: ["aClass"],
  12997. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  12998. messageSends: [],
  12999. referencedClasses: []
  13000. }),
  13001. smalltalk.AnnouncementSubscription);
  13002. smalltalk.addMethod(
  13003. "_block",
  13004. smalltalk.method({
  13005. selector: "block",
  13006. category: 'accessing',
  13007. fn: function (){
  13008. var self=this;
  13009. return self["@block"];
  13010. },
  13011. args: [],
  13012. source: "block\x0a\x09^block",
  13013. messageSends: [],
  13014. referencedClasses: []
  13015. }),
  13016. smalltalk.AnnouncementSubscription);
  13017. smalltalk.addMethod(
  13018. "_block_",
  13019. smalltalk.method({
  13020. selector: "block:",
  13021. category: 'accessing',
  13022. fn: function (aBlock){
  13023. var self=this;
  13024. self["@block"]=aBlock;
  13025. return self},
  13026. args: ["aBlock"],
  13027. source: "block: aBlock\x0a\x09block := aBlock",
  13028. messageSends: [],
  13029. referencedClasses: []
  13030. }),
  13031. smalltalk.AnnouncementSubscription);
  13032. smalltalk.addMethod(
  13033. "_deliver_",
  13034. smalltalk.method({
  13035. selector: "deliver:",
  13036. category: 'announcing',
  13037. fn: function (anAnnouncement){
  13038. var self=this;
  13039. var $1;
  13040. $1=smalltalk.send(self,"_handlesAnnouncement_",[anAnnouncement]);
  13041. if(smalltalk.assert($1)){
  13042. smalltalk.send(smalltalk.send(self,"_block",[]),"_value_",[anAnnouncement]);
  13043. };
  13044. return self},
  13045. args: ["anAnnouncement"],
  13046. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
  13047. messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
  13048. referencedClasses: []
  13049. }),
  13050. smalltalk.AnnouncementSubscription);
  13051. smalltalk.addMethod(
  13052. "_handlesAnnouncement_",
  13053. smalltalk.method({
  13054. selector: "handlesAnnouncement:",
  13055. category: 'announcing',
  13056. fn: function (anAnnouncement){
  13057. var self=this;
  13058. var $1;
  13059. $1=smalltalk.send(anAnnouncement,"_isKindOf_",[smalltalk.send(self,"_announcementClass",[])]);
  13060. return $1;
  13061. },
  13062. args: ["anAnnouncement"],
  13063. source: "handlesAnnouncement: anAnnouncement\x0a\x09^anAnnouncement isKindOf: self announcementClass",
  13064. messageSends: ["isKindOf:", "announcementClass"],
  13065. referencedClasses: []
  13066. }),
  13067. smalltalk.AnnouncementSubscription);
  13068. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  13069. smalltalk.addMethod(
  13070. "_announce_",
  13071. smalltalk.method({
  13072. selector: "announce:",
  13073. category: 'announcing',
  13074. fn: function (anAnnouncement){
  13075. var self=this;
  13076. smalltalk.send(self["@subscriptions"],"_do_",[(function(each){
  13077. return smalltalk.send(each,"_deliver_",[anAnnouncement]);
  13078. })]);
  13079. return self},
  13080. args: ["anAnnouncement"],
  13081. source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
  13082. messageSends: ["do:", "deliver:"],
  13083. referencedClasses: []
  13084. }),
  13085. smalltalk.Announcer);
  13086. smalltalk.addMethod(
  13087. "_initialize",
  13088. smalltalk.method({
  13089. selector: "initialize",
  13090. category: 'initialization',
  13091. fn: function (){
  13092. var self=this;
  13093. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  13094. self["@subscriptions"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  13095. return self},
  13096. args: [],
  13097. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
  13098. messageSends: ["initialize", "new"],
  13099. referencedClasses: ["Array"]
  13100. }),
  13101. smalltalk.Announcer);
  13102. smalltalk.addMethod(
  13103. "_on_do_",
  13104. smalltalk.method({
  13105. selector: "on:do:",
  13106. category: 'subscribing',
  13107. fn: function (aClass,aBlock){
  13108. var self=this;
  13109. var $1,$2;
  13110. $1=smalltalk.send((smalltalk.AnnouncementSubscription || AnnouncementSubscription),"_new",[]);
  13111. smalltalk.send($1,"_block_",[aBlock]);
  13112. smalltalk.send($1,"_announcementClass_",[aClass]);
  13113. $2=smalltalk.send($1,"_yourself",[]);
  13114. smalltalk.send(self["@subscriptions"],"_add_",[$2]);
  13115. return self},
  13116. args: ["aClass", "aBlock"],
  13117. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  13118. messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
  13119. referencedClasses: ["AnnouncementSubscription"]
  13120. }),
  13121. smalltalk.Announcer);
  13122. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  13123. smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces"
  13124. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  13125. smalltalk.addMethod(
  13126. "_current",
  13127. smalltalk.method({
  13128. selector: "current",
  13129. category: 'accessing',
  13130. fn: function (){
  13131. var self=this;
  13132. var $1;
  13133. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  13134. self["@current"]=smalltalk.send(self,"_new",[],smalltalk.Announcer.klass);
  13135. $1=self["@current"];
  13136. } else {
  13137. $1=self["@current"];
  13138. };
  13139. return $1;
  13140. },
  13141. args: [],
  13142. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  13143. messageSends: ["ifNil:", "new"],
  13144. referencedClasses: []
  13145. }),
  13146. smalltalk.SystemAnnouncer.klass);
  13147. smalltalk.addMethod(
  13148. "_new",
  13149. smalltalk.method({
  13150. selector: "new",
  13151. category: 'instance creation',
  13152. fn: function (){
  13153. var self=this;
  13154. smalltalk.send(self,"_shouldNotImplement",[]);
  13155. return self},
  13156. args: [],
  13157. source: "new\x0a\x09self shouldNotImplement",
  13158. messageSends: ["shouldNotImplement"],
  13159. referencedClasses: []
  13160. }),
  13161. smalltalk.SystemAnnouncer.klass);
  13162. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  13163. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements"
  13164. smalltalk.addMethod(
  13165. "_theClass",
  13166. smalltalk.method({
  13167. selector: "theClass",
  13168. category: 'accessing',
  13169. fn: function (){
  13170. var self=this;
  13171. return self["@theClass"];
  13172. },
  13173. args: [],
  13174. source: "theClass\x0a\x09^ theClass",
  13175. messageSends: [],
  13176. referencedClasses: []
  13177. }),
  13178. smalltalk.SystemAnnouncement);
  13179. smalltalk.addMethod(
  13180. "_theClass_",
  13181. smalltalk.method({
  13182. selector: "theClass:",
  13183. category: 'accessing',
  13184. fn: function (aClass){
  13185. var self=this;
  13186. self["@theClass"]=aClass;
  13187. return self},
  13188. args: ["aClass"],
  13189. source: "theClass: aClass\x0a\x09theClass := aClass",
  13190. messageSends: [],
  13191. referencedClasses: []
  13192. }),
  13193. smalltalk.SystemAnnouncement);
  13194. smalltalk.addClass('ClassAdded', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13195. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"
  13196. smalltalk.addClass('ClassCommentChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13197. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"
  13198. smalltalk.addClass('ClassDefinitionChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13199. smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
  13200. smalltalk.addClass('ClassRemoved', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13201. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"
  13202. smalltalk.addClass('ClassRenamed', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13203. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"
  13204. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  13205. smalltalk.addMethod(
  13206. "_method",
  13207. smalltalk.method({
  13208. selector: "method",
  13209. category: 'accessing',
  13210. fn: function (){
  13211. var self=this;
  13212. return self["@method"];
  13213. },
  13214. args: [],
  13215. source: "method\x0a\x09^ method",
  13216. messageSends: [],
  13217. referencedClasses: []
  13218. }),
  13219. smalltalk.MethodAnnouncement);
  13220. smalltalk.addMethod(
  13221. "_method_",
  13222. smalltalk.method({
  13223. selector: "method:",
  13224. category: 'accessing',
  13225. fn: function (aCompiledMethod){
  13226. var self=this;
  13227. self["@method"]=aCompiledMethod;
  13228. return self},
  13229. args: ["aCompiledMethod"],
  13230. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  13231. messageSends: [],
  13232. referencedClasses: []
  13233. }),
  13234. smalltalk.MethodAnnouncement);
  13235. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  13236. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  13237. smalltalk.addPackage('FileServer', {});
  13238. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'port', 'basePath', 'util', 'username', 'password'], 'FileServer');
  13239. smalltalk.addMethod(
  13240. "_basePath",
  13241. smalltalk.method({
  13242. selector: "basePath",
  13243. category: 'accessing',
  13244. fn: function (){
  13245. var self=this;
  13246. return (($receiver = self['@basePath']) == nil || $receiver == undefined) ? (function(){return "./";})() : $receiver;
  13247. return self;},
  13248. args: [],
  13249. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  13250. messageSends: ["ifNil:"],
  13251. referencedClasses: []
  13252. }),
  13253. smalltalk.FileServer);
  13254. smalltalk.addMethod(
  13255. "_basePath_",
  13256. smalltalk.method({
  13257. selector: "basePath:",
  13258. category: 'accessing',
  13259. fn: function (aString){
  13260. var self=this;
  13261. (self['@basePath']=aString);
  13262. return self;},
  13263. args: ["aString"],
  13264. source: "basePath: aString\x0a\x09basePath := aString",
  13265. messageSends: [],
  13266. referencedClasses: []
  13267. }),
  13268. smalltalk.FileServer);
  13269. smalltalk.addMethod(
  13270. "_checkDirectoryLayout",
  13271. smalltalk.method({
  13272. selector: "checkDirectoryLayout",
  13273. category: 'initialization',
  13274. fn: function (){
  13275. var self=this;
  13276. ((($receiver = smalltalk.send(self['@path'], "_existsSync_", [smalltalk.send(smalltalk.send(self, "_basePath", []), "__comma", ["index.html"])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", ["Warning: project directory does not contain index.html"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", ["Warning: project directory does not contain index.html"]);})]));
  13277. ((($receiver = smalltalk.send(self['@path'], "_existsSync_", [smalltalk.send(smalltalk.send(self, "_basePath", []), "__comma", ["st"])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", ["Warning: project directory is missing an \x22st\x22 directory"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", ["Warning: project directory is missing an \x22st\x22 directory"]);})]));
  13278. ((($receiver = smalltalk.send(self['@path'], "_existsSync_", [smalltalk.send(smalltalk.send(self, "_basePath", []), "__comma", ["js"])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", ["Warning: project directory is missing a \x22js\x22 directory"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", ["Warning: project directory is missing a \x22js\x22 directory"]);})]));
  13279. return self;},
  13280. args: [],
  13281. source: "checkDirectoryLayout\x0a\x09(path existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(path existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(path existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
  13282. messageSends: ["ifFalse:", "existsSync:", ",", "basePath", "warn:"],
  13283. referencedClasses: []
  13284. }),
  13285. smalltalk.FileServer);
  13286. smalltalk.addMethod(
  13287. "_handleGETRequest_respondTo_",
  13288. smalltalk.method({
  13289. selector: "handleGETRequest:respondTo:",
  13290. category: 'request handling',
  13291. fn: function (aRequest, aResponse){
  13292. var self=this;
  13293. var uri=nil;
  13294. var filename=nil;
  13295. (uri=smalltalk.send(smalltalk.send(self['@url'], "_parse_", [smalltalk.send(aRequest, "_url", [])]), "_pathname", []));
  13296. (filename=smalltalk.send(self['@path'], "_join_with_", [smalltalk.send(self, "_basePath", []), uri]));
  13297. smalltalk.send(self['@path'], "_exists_do_", [filename, (function(aBoolean){return ((($receiver = aBoolean).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]);})]));})]);
  13298. return self;},
  13299. args: ["aRequest", "aResponse"],
  13300. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := (url parse: aRequest url) pathname.\x0a\x09filename := path join: self basePath with: uri.\x0a\x09path exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
  13301. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  13302. referencedClasses: []
  13303. }),
  13304. smalltalk.FileServer);
  13305. smalltalk.addMethod(
  13306. "_handleOPTIONSRequest_respondTo_",
  13307. smalltalk.method({
  13308. selector: "handleOPTIONSRequest:respondTo:",
  13309. category: 'request handling',
  13310. fn: function (aRequest, aResponse){
  13311. var self=this;
  13312. 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)])])]);
  13313. smalltalk.send(aResponse, "_end", []);
  13314. return self;},
  13315. args: ["aRequest", "aResponse"],
  13316. 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",
  13317. messageSends: ["writeHead:options:", "->", "end"],
  13318. referencedClasses: []
  13319. }),
  13320. smalltalk.FileServer);
  13321. smalltalk.addMethod(
  13322. "_handlePUTRequest_respondTo_",
  13323. smalltalk.method({
  13324. selector: "handlePUTRequest:respondTo:",
  13325. category: 'request handling',
  13326. fn: function (aRequest, aResponse){
  13327. var self=this;
  13328. var file=nil;
  13329. var stream=nil;
  13330. ((($receiver = smalltalk.send(self, "_isAuthenticated_response_", [aRequest, aResponse])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_respondAuthenticationRequiredTo_", [aResponse]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_respondAuthenticationRequiredTo_", [aResponse]);})]));
  13331. (file=smalltalk.send(".", "__comma", [smalltalk.send(aRequest, "_url", [])]));
  13332. (stream=smalltalk.send(self['@fs'], "_createWriteStream_", [file]));
  13333. smalltalk.send(stream, "_on_do_", ["error", (function(error){smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", [smalltalk.send("Error creating WriteStream for file ", "__comma", [file])]);smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", [" Did you forget to create the necessary js/ or st/ directory in your project?"]);smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", [smalltalk.send(" The exact error is: ", "__comma", [error])]);return smalltalk.send(self, "_respondNotCreatedTo_", [aResponse]);})]);
  13334. smalltalk.send(stream, "_on_do_", ["close", (function(){return smalltalk.send(self, "_respondCreatedTo_", [aResponse]);})]);
  13335. smalltalk.send(aRequest, "_setEncoding_", ["utf8"]);
  13336. smalltalk.send(aRequest, "_on_do_", ["data", (function(data){return smalltalk.send(stream, "_write_", [data]);})]);
  13337. smalltalk.send(aRequest, "_on_do_", ["end", (function(){return ((($receiver = smalltalk.send(stream, "_writable", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(stream, "_end", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(stream, "_end", []);})]));})]);
  13338. return self;},
  13339. args: ["aRequest", "aResponse"],
  13340. source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest response: aResponse)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary js/ or st/ directory in your project?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]",
  13341. messageSends: ["ifFalse:", "isAuthenticated:response:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"],
  13342. referencedClasses: []
  13343. }),
  13344. smalltalk.FileServer);
  13345. smalltalk.addMethod(
  13346. "_handleRequest_respondTo_",
  13347. smalltalk.method({
  13348. selector: "handleRequest:respondTo:",
  13349. category: 'request handling',
  13350. fn: function (aRequest, aResponse){
  13351. var self=this;
  13352. ((($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]);})]));
  13353. ((($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]);})]));
  13354. ((($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]);})]));
  13355. return self;},
  13356. args: ["aRequest", "aResponse"],
  13357. source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]",
  13358. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  13359. referencedClasses: []
  13360. }),
  13361. smalltalk.FileServer);
  13362. smalltalk.addMethod(
  13363. "_initialize",
  13364. smalltalk.method({
  13365. selector: "initialize",
  13366. category: 'initialization',
  13367. fn: function (){
  13368. var self=this;
  13369. smalltalk.send((typeof super_ == 'undefined' ? nil : super_), "_initialize", []);
  13370. (self['@path']=smalltalk.send(self, "_require_", ["path"]));
  13371. (self['@http']=smalltalk.send(self, "_require_", ["http"]));
  13372. (self['@fs']=smalltalk.send(self, "_require_", ["fs"]));
  13373. (self['@util']=smalltalk.send(self, "_require_", ["util"]));
  13374. (self['@url']=smalltalk.send(self, "_require_", ["url"]));
  13375. (self['@port']=smalltalk.send(smalltalk.send(self, "_class", []), "_defaultPort", []));
  13376. (self['@username']=nil);
  13377. (self['@password']=nil);
  13378. return self;},
  13379. args: [],
  13380. source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.",
  13381. messageSends: ["initialize", "require:", "defaultPort", "class"],
  13382. referencedClasses: []
  13383. }),
  13384. smalltalk.FileServer);
  13385. smalltalk.addMethod(
  13386. "_isAuthenticated_response_",
  13387. smalltalk.method({
  13388. selector: "isAuthenticated:response:",
  13389. category: 'private',
  13390. fn: function (aRequest, aResponse){
  13391. var self=this;
  13392. var $early={};
  13393. try{var header=nil;
  13394. var token=nil;
  13395. var auth=nil;
  13396. var parts=nil;
  13397. ((($receiver = smalltalk.send(smalltalk.send(self['@username'], "_isNil", []), "_and_", [(function(){return smalltalk.send(self['@password'], "_isNil", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){throw $early=[true]})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function(){throw $early=[true]})();})]));
  13398. (header=(($receiver = smalltalk.send(smalltalk.send(aRequest, "_headers", []), "_at_", ["authorization"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver);
  13399. ((($receiver = smalltalk.send(header, "_isEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){throw $early=[false]})();})() : (function(){(token=(($receiver = smalltalk.send(header, "_tokenize_", [" "])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver);auth = new Buffer(token[1], 'base64').toString();(parts=smalltalk.send(auth, "_tokenize_", [":"]));return ((($receiver = smalltalk.send(smalltalk.send(self['@username'], "__eq", [smalltalk.send(parts, "_at_", [(1)])]), "_and_", [(function(){return smalltalk.send(self['@password'], "__eq", [smalltalk.send(parts, "_at_", [(2)])]);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){throw $early=[true]})();})() : (function(){return (function(){throw $early=[false]})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (function(){throw $early=[true]})();}), (function(){return (function(){throw $early=[false]})();})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (function(){throw $early=[false]})();}), (function(){(token=(($receiver = smalltalk.send(header, "_tokenize_", [" "])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver);auth = new Buffer(token[1], 'base64').toString();(parts=smalltalk.send(auth, "_tokenize_", [":"]));return ((($receiver = smalltalk.send(smalltalk.send(self['@username'], "__eq", [smalltalk.send(parts, "_at_", [(1)])]), "_and_", [(function(){return smalltalk.send(self['@password'], "__eq", [smalltalk.send(parts, "_at_", [(2)])]);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){throw $early=[true]})();})() : (function(){return (function(){throw $early=[false]})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (function(){throw $early=[true]})();}), (function(){return (function(){throw $early=[false]})();})]));})]));
  13400. return self;
  13401. } catch(e) {if(e===$early)return e[0]; throw e}},
  13402. args: ["aRequest", "aResponse"],
  13403. source: "isAuthenticated: aRequest response: aResponse\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09<auth = new Buffer(token[1], 'base64').toString()>.\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^true]\x0a\x09\x09\x09ifFalse: [^false]\x0a\x09].",
  13404. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "="],
  13405. referencedClasses: []
  13406. }),
  13407. smalltalk.FileServer);
  13408. smalltalk.addMethod(
  13409. "_password_",
  13410. smalltalk.method({
  13411. selector: "password:",
  13412. category: 'accessing',
  13413. fn: function (aPassword){
  13414. var self=this;
  13415. (self['@password']=aPassword);
  13416. return self;},
  13417. args: ["aPassword"],
  13418. source: "password: aPassword\x0a\x09password := aPassword.",
  13419. messageSends: [],
  13420. referencedClasses: []
  13421. }),
  13422. smalltalk.FileServer);
  13423. smalltalk.addMethod(
  13424. "_port",
  13425. smalltalk.method({
  13426. selector: "port",
  13427. category: 'accessing',
  13428. fn: function (){
  13429. var self=this;
  13430. return self['@port'];
  13431. return self;},
  13432. args: [],
  13433. source: "port\x0a\x09^port",
  13434. messageSends: [],
  13435. referencedClasses: []
  13436. }),
  13437. smalltalk.FileServer);
  13438. smalltalk.addMethod(
  13439. "_port_",
  13440. smalltalk.method({
  13441. selector: "port:",
  13442. category: 'accessing',
  13443. fn: function (aNumber){
  13444. var self=this;
  13445. (self['@port']=aNumber);
  13446. return self;},
  13447. args: ["aNumber"],
  13448. source: "port: aNumber\x0a\x09port := aNumber",
  13449. messageSends: [],
  13450. referencedClasses: []
  13451. }),
  13452. smalltalk.FileServer);
  13453. smalltalk.addMethod(
  13454. "_require_",
  13455. smalltalk.method({
  13456. selector: "require:",
  13457. category: 'private',
  13458. fn: function (aModuleString){
  13459. var self=this;
  13460. return smalltalk.send((typeof require == 'undefined' ? nil : require), "_value_", [aModuleString]);
  13461. return self;},
  13462. args: ["aModuleString"],
  13463. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  13464. messageSends: ["value:"],
  13465. referencedClasses: []
  13466. }),
  13467. smalltalk.FileServer);
  13468. smalltalk.addMethod(
  13469. "_respondAuthenticationRequiredTo_",
  13470. smalltalk.method({
  13471. selector: "respondAuthenticationRequiredTo:",
  13472. category: 'request handling',
  13473. fn: function (aResponse){
  13474. var self=this;
  13475. (function($rec){smalltalk.send($rec, "_writeHead_options_", [(401), smalltalk.HashedCollection._fromPairs_([smalltalk.send("WWW-Authenticate", "__minus_gt", ["Basic realm=\x22Secured Developer Area\x22"])])]);smalltalk.send($rec, "_write_", ["<html><body>Authentication needed</body></html>"]);return smalltalk.send($rec, "_end", []);})(aResponse);
  13476. return self;},
  13477. args: ["aResponse"],
  13478. source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: '<html><body>Authentication needed</body></html>';\x0a\x09\x09end.",
  13479. messageSends: ["writeHead:options:", "->", "write:", "end"],
  13480. referencedClasses: []
  13481. }),
  13482. smalltalk.FileServer);
  13483. smalltalk.addMethod(
  13484. "_respondCreatedTo_",
  13485. smalltalk.method({
  13486. selector: "respondCreatedTo:",
  13487. category: 'request handling',
  13488. fn: function (aResponse){
  13489. var self=this;
  13490. (function($rec){smalltalk.send($rec, "_writeHead_options_", [(201), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", ["text/plain"]),smalltalk.send("Access-Control-Allow-Origin", "__minus_gt", ["*"])])]);return smalltalk.send($rec, "_end", []);})(aResponse);
  13491. return self;},
  13492. args: ["aResponse"],
  13493. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  13494. messageSends: ["writeHead:options:", "->", "end"],
  13495. referencedClasses: []
  13496. }),
  13497. smalltalk.FileServer);
  13498. smalltalk.addMethod(
  13499. "_respondFileNamed_to_",
  13500. smalltalk.method({
  13501. selector: "respondFileNamed:to:",
  13502. category: 'request handling',
  13503. fn: function (aFilename, aResponse){
  13504. var self=this;
  13505. var type=nil;
  13506. var filename=nil;
  13507. (filename=aFilename);
  13508. ((($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"]));})]));
  13509. smalltalk.send(self['@fs'], "_readFile_do_", [filename, (function(ex, file){return ((($receiver = smalltalk.send(ex, "_notNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(filename, "__comma", [" does not exist"])]);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(){smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(filename, "__comma", [" does not exist"])]);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);})]));})]);
  13510. return self;},
  13511. args: ["aFilename", "aResponse"],
  13512. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a \x09filename := filename, 'index.html'].\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondInternalErrorTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]",
  13513. messageSends: ["ifTrue:", "isDirectory", "statSync:", ",", "readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end"],
  13514. referencedClasses: []
  13515. }),
  13516. smalltalk.FileServer);
  13517. smalltalk.addMethod(
  13518. "_respondInternalErrorTo_",
  13519. smalltalk.method({
  13520. selector: "respondInternalErrorTo:",
  13521. category: 'request handling',
  13522. fn: function (aResponse){
  13523. var self=this;
  13524. (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);
  13525. return self;},
  13526. args: ["aResponse"],
  13527. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  13528. messageSends: ["writeHead:options:", "->", "write:", "end"],
  13529. referencedClasses: []
  13530. }),
  13531. smalltalk.FileServer);
  13532. smalltalk.addMethod(
  13533. "_respondNotCreatedTo_",
  13534. smalltalk.method({
  13535. selector: "respondNotCreatedTo:",
  13536. category: 'request handling',
  13537. fn: function (aResponse){
  13538. var self=this;
  13539. (function($rec){smalltalk.send($rec, "_writeHead_options_", [(400), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", ["text/plain"])])]);smalltalk.send($rec, "_write_", ["File could not be created. Did you forget to create the st/js directories on the server?"]);return smalltalk.send($rec, "_end", []);})(aResponse);
  13540. return self;},
  13541. args: ["aResponse"],
  13542. source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the st/js directories on the server?';\x0a\x09\x09end.",
  13543. messageSends: ["writeHead:options:", "->", "write:", "end"],
  13544. referencedClasses: []
  13545. }),
  13546. smalltalk.FileServer);
  13547. smalltalk.addMethod(
  13548. "_respondNotFoundTo_",
  13549. smalltalk.method({
  13550. selector: "respondNotFoundTo:",
  13551. category: 'request handling',
  13552. fn: function (aResponse){
  13553. var self=this;
  13554. (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);
  13555. return self;},
  13556. args: ["aResponse"],
  13557. source: "respondNotFoundTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
  13558. messageSends: ["writeHead:options:", "->", "write:", "end"],
  13559. referencedClasses: []
  13560. }),
  13561. smalltalk.FileServer);
  13562. smalltalk.addMethod(
  13563. "_respondOKTo_",
  13564. smalltalk.method({
  13565. selector: "respondOKTo:",
  13566. category: 'request handling',
  13567. fn: function (aResponse){
  13568. var self=this;
  13569. (function($rec){smalltalk.send($rec, "_writeHead_options_", [(200), smalltalk.HashedCollection._fromPairs_([smalltalk.send("Content-Type", "__minus_gt", ["text/plain"]),smalltalk.send("Access-Control-Allow-Origin", "__minus_gt", ["*"])])]);return smalltalk.send($rec, "_end", []);})(aResponse);
  13570. return self;},
  13571. args: ["aResponse"],
  13572. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  13573. messageSends: ["writeHead:options:", "->", "end"],
  13574. referencedClasses: []
  13575. }),
  13576. smalltalk.FileServer);
  13577. smalltalk.addMethod(
  13578. "_start",
  13579. smalltalk.method({
  13580. selector: "start",
  13581. category: 'starting',
  13582. fn: function (){
  13583. var self=this;
  13584. (function($rec){smalltalk.send($rec, "_on_do_", ["error", (function(error){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send("Error starting server: ", "__comma", [error])]);})]);smalltalk.send($rec, "_on_do_", ["listening", (function(){return smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send("Starting file server on port ", "__comma", [smalltalk.send(smalltalk.send(self, "_port", []), "_asString", [])])]);})]);return smalltalk.send($rec, "_listen_", [smalltalk.send(self, "_port", [])]);})(smalltalk.send(self['@http'], "_createServer_", [(function(request, response){return smalltalk.send(self, "_handleRequest_respondTo_", [request, response]);})]));
  13585. return self;},
  13586. args: [],
  13587. source: "start\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on port ', self port asString];\x0a\x09 listen: self port.",
  13588. messageSends: ["on:do:", "log:", ",", "asString", "port", "listen:", "createServer:", "handleRequest:respondTo:"],
  13589. referencedClasses: []
  13590. }),
  13591. smalltalk.FileServer);
  13592. smalltalk.addMethod(
  13593. "_startOn_",
  13594. smalltalk.method({
  13595. selector: "startOn:",
  13596. category: 'starting',
  13597. fn: function (aPort){
  13598. var self=this;
  13599. smalltalk.send(self, "_port_", [aPort]);
  13600. smalltalk.send(self, "_start", []);
  13601. return self;},
  13602. args: ["aPort"],
  13603. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  13604. messageSends: ["port:", "start"],
  13605. referencedClasses: []
  13606. }),
  13607. smalltalk.FileServer);
  13608. smalltalk.addMethod(
  13609. "_username_",
  13610. smalltalk.method({
  13611. selector: "username:",
  13612. category: 'accessing',
  13613. fn: function (aUsername){
  13614. var self=this;
  13615. (self['@username']=aUsername);
  13616. return self;},
  13617. args: ["aUsername"],
  13618. source: "username: aUsername\x0a\x09username := aUsername.",
  13619. messageSends: [],
  13620. referencedClasses: []
  13621. }),
  13622. smalltalk.FileServer);
  13623. smalltalk.addMethod(
  13624. "_username_password_",
  13625. smalltalk.method({
  13626. selector: "username:password:",
  13627. category: 'accessing',
  13628. fn: function (aUsername, aPassword){
  13629. var self=this;
  13630. (self['@username']=aUsername);
  13631. (self['@password']=aPassword);
  13632. return self;},
  13633. args: ["aUsername", "aPassword"],
  13634. source: "username: aUsername password: aPassword\x0a\x09username := aUsername.\x0a\x09password := aPassword.",
  13635. messageSends: [],
  13636. referencedClasses: []
  13637. }),
  13638. smalltalk.FileServer);
  13639. smalltalk.addMethod(
  13640. "_writeData_toFileNamed_",
  13641. smalltalk.method({
  13642. selector: "writeData:toFileNamed:",
  13643. category: 'private',
  13644. fn: function (data, aFilename){
  13645. var self=this;
  13646. smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [aFilename]);
  13647. return self;},
  13648. args: ["data", "aFilename"],
  13649. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  13650. messageSends: ["log:"],
  13651. referencedClasses: []
  13652. }),
  13653. smalltalk.FileServer);
  13654. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  13655. smalltalk.addMethod(
  13656. "_commandLineActions",
  13657. smalltalk.method({
  13658. selector: "commandLineActions",
  13659. category: 'accessing',
  13660. fn: function (){
  13661. var self=this;
  13662. return smalltalk.HashedCollection._fromPairs_([smalltalk.send("-p", "__minus_gt", [(function(fileServer, value){return smalltalk.send(fileServer, "_port_", [value]);})]),smalltalk.send("--username", "__minus_gt", [(function(fileServer, value){return smalltalk.send(fileServer, "_username_", [value]);})]),smalltalk.send("--password", "__minus_gt", [(function(fileServer, value){return smalltalk.send(fileServer, "_password_", [value]);})])]);
  13663. return self;},
  13664. args: [],
  13665. source: "commandLineActions\x0a\x09^#{\x0a\x09\x09'-p' -> [:fileServer :value | fileServer port: value].\x0a\x09\x09'--username' -> [:fileServer :value | fileServer username: value].\x0a\x09\x09'--password' -> [:fileServer :value | fileServer password: value]\x0a\x09}",
  13666. messageSends: ["->", "port:", "username:", "password:"],
  13667. referencedClasses: []
  13668. }),
  13669. smalltalk.FileServer.klass);
  13670. smalltalk.addMethod(
  13671. "_createServerWithArguments_",
  13672. smalltalk.method({
  13673. selector: "createServerWithArguments:",
  13674. category: 'initialization',
  13675. fn: function (options){
  13676. var self=this;
  13677. var $early={};
  13678. try{var server=nil;
  13679. var actions=nil;
  13680. var popFront=nil;
  13681. var front=nil;
  13682. var optionName=nil;
  13683. var optionValue=nil;
  13684. (actions=smalltalk.send((smalltalk.FileServer || FileServer), "_commandLineActions", []));
  13685. (popFront=(function(args){(front=smalltalk.send(args, "_first", []));smalltalk.send(args, "_remove_", [front]);return front;}));
  13686. (server=smalltalk.send(self, "_new", []));
  13687. smalltalk.send(options, "_ifEmpty_", [(function(){return (function(){throw $early=[server]})();})]);
  13688. ((($receiver = smalltalk.send(smalltalk.send(options, "_size", []), "_even", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send("Using default parameters. Not enough arguments: ", "__comma", [options])]);return (function(){throw $early=[server]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send("Using default parameters. Not enough arguments: ", "__comma", [options])]);return (function(){throw $early=[server]})();})]));
  13689. (function(){while((function(){return smalltalk.send(options, "_notEmpty", []);})()) {(function(){(optionName=smalltalk.send(popFront, "_value_", [options]));(optionValue=smalltalk.send(popFront, "_value_", [options]));return smalltalk.send(smalltalk.send(actions, "_at_ifAbsent_", [optionName, (function(){return nil;})]), "_value_value_", [server, optionValue]);})()}})();
  13690. return server;
  13691. return self;
  13692. } catch(e) {if(e===$early)return e[0]; throw e}},
  13693. args: ["options"],
  13694. source: "createServerWithArguments: options\x0a\x09| server actions popFront front optionName optionValue |\x0a\x09actions := FileServer commandLineActions.\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x09(options size even) ifFalse: [console log: 'Using default parameters. Not enough arguments: ' , options. ^server].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x09\x09(actions at: optionName ifAbsent: []) value: server value: optionValue.\x0a\x09].\x0a\x0a\x09^server.",
  13695. messageSends: ["commandLineActions", "first", "remove:", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "whileTrue:", "notEmpty", "value:", "value:value:", "at:ifAbsent:"],
  13696. referencedClasses: ["FileServer"]
  13697. }),
  13698. smalltalk.FileServer.klass);
  13699. smalltalk.addMethod(
  13700. "_defaultMimeTypes",
  13701. smalltalk.method({
  13702. selector: "defaultMimeTypes",
  13703. category: 'accessing',
  13704. fn: function (){
  13705. var self=this;
  13706. 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"])]);
  13707. return self;},
  13708. args: [],
  13709. 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}",
  13710. messageSends: ["->"],
  13711. referencedClasses: []
  13712. }),
  13713. smalltalk.FileServer.klass);
  13714. smalltalk.addMethod(
  13715. "_defaultPort",
  13716. smalltalk.method({
  13717. selector: "defaultPort",
  13718. category: 'accessing',
  13719. fn: function (){
  13720. var self=this;
  13721. return (4000);
  13722. return self;},
  13723. args: [],
  13724. source: "defaultPort\x0a\x09^4000",
  13725. messageSends: [],
  13726. referencedClasses: []
  13727. }),
  13728. smalltalk.FileServer.klass);
  13729. smalltalk.addMethod(
  13730. "_main",
  13731. smalltalk.method({
  13732. selector: "main",
  13733. category: 'initialization',
  13734. fn: function (){
  13735. var self=this;
  13736. var fileServer=nil;
  13737. var args=nil;
  13738. (args=smalltalk.send((typeof process == 'undefined' ? nil : process), "_argv", []));
  13739. smalltalk.send(args, "_removeFrom_to_", [(1), (3)]);
  13740. (fileServer=smalltalk.send((smalltalk.FileServer || FileServer), "_createServerWithArguments_", [args]));
  13741. smalltalk.send(fileServer, "_checkDirectoryLayout", []);
  13742. return smalltalk.send(fileServer, "_start", []);
  13743. return self;},
  13744. args: [],
  13745. source: "main\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09fileServer := FileServer createServerWithArguments: args.\x0a\x0a\x09fileServer checkDirectoryLayout.\x0a\x09^fileServer start",
  13746. messageSends: ["argv", "removeFrom:to:", "createServerWithArguments:", "checkDirectoryLayout", "start"],
  13747. referencedClasses: ["FileServer"]
  13748. }),
  13749. smalltalk.FileServer.klass);
  13750. smalltalk.addMethod(
  13751. "_mimeTypeFor_",
  13752. smalltalk.method({
  13753. selector: "mimeTypeFor:",
  13754. category: 'accessing',
  13755. fn: function (aString){
  13756. var self=this;
  13757. return smalltalk.send(smalltalk.send(self, "_mimeTypes", []), "_at_ifAbsent_", [smalltalk.send(aString, "_replace_with_", [".*[\x5c.]", ""]), (function(){return "text/plain";})]);
  13758. return self;},
  13759. args: ["aString"],
  13760. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  13761. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"],
  13762. referencedClasses: []
  13763. }),
  13764. smalltalk.FileServer.klass);
  13765. smalltalk.addMethod(
  13766. "_mimeTypes",
  13767. smalltalk.method({
  13768. selector: "mimeTypes",
  13769. category: 'accessing',
  13770. fn: function (){
  13771. var self=this;
  13772. return (($receiver = self['@mimeTypes']) == nil || $receiver == undefined) ? (function(){return (self['@mimeTypes']=smalltalk.send(self, "_defaultMimeTypes", []));})() : $receiver;
  13773. return self;},
  13774. args: [],
  13775. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  13776. messageSends: ["ifNil:", "defaultMimeTypes"],
  13777. referencedClasses: []
  13778. }),
  13779. smalltalk.FileServer.klass);
  13780. smalltalk.init(smalltalk.Object); //metaclasses are in through Class
  13781. smalltalk.classes()._do_(function(each) {
  13782. each._initialize()});
  13783. /* Similar to jQuery(document).ready() */
  13784. if(this.smalltalkReady) {
  13785. this.smalltalkReady();
  13786. }
  13787. smalltalk.FileServer._main()