Kernel-Objects.js 192 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877
  1. smalltalk.addPackage('Kernel-Objects');
  2. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  3. smalltalk.Object.comment="**I am the root of the Smalltalk class system**. All classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects, such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "->",
  7. category: 'converting',
  8. fn: function (anObject){
  9. var self=this;
  10. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  11. return smalltalk.withContext(function($ctx1) {
  12. var $1;
  13. $1=_st($Association())._key_value_(self,anObject);
  14. return $1;
  15. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},smalltalk.Object)})},
  16. args: ["anObject"],
  17. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  18. messageSends: ["key:value:"],
  19. referencedClasses: ["Association"]
  20. }),
  21. smalltalk.Object);
  22. smalltalk.addMethod(
  23. smalltalk.method({
  24. selector: "=",
  25. category: 'comparing',
  26. fn: function (anObject){
  27. var self=this;
  28. return smalltalk.withContext(function($ctx1) {
  29. var $1;
  30. $1=self.__eq_eq(anObject);
  31. return $1;
  32. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},smalltalk.Object)})},
  33. args: ["anObject"],
  34. source: "= anObject\x0a\x09^self == anObject",
  35. messageSends: ["=="],
  36. referencedClasses: []
  37. }),
  38. smalltalk.Object);
  39. smalltalk.addMethod(
  40. smalltalk.method({
  41. selector: "==",
  42. category: 'comparing',
  43. fn: function (anObject){
  44. var self=this;
  45. return smalltalk.withContext(function($ctx1) {
  46. var $1;
  47. $1=_st(self._identityHash()).__eq(_st(anObject)._identityHash());
  48. return $1;
  49. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},smalltalk.Object)})},
  50. args: ["anObject"],
  51. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  52. messageSends: ["=", "identityHash"],
  53. referencedClasses: []
  54. }),
  55. smalltalk.Object);
  56. smalltalk.addMethod(
  57. smalltalk.method({
  58. selector: "asJSON",
  59. category: 'converting',
  60. fn: function (){
  61. var self=this;
  62. var variables;
  63. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  64. return smalltalk.withContext(function($ctx1) {
  65. var $1;
  66. variables=_st($HashedCollection())._new();
  67. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  68. return smalltalk.withContext(function($ctx2) {
  69. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  70. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  71. $1=variables;
  72. return $1;
  73. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},smalltalk.Object)})},
  74. args: [],
  75. 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",
  76. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  77. referencedClasses: ["HashedCollection"]
  78. }),
  79. smalltalk.Object);
  80. smalltalk.addMethod(
  81. smalltalk.method({
  82. selector: "asJSONString",
  83. category: 'converting',
  84. fn: function (){
  85. var self=this;
  86. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  87. return smalltalk.withContext(function($ctx1) {
  88. var $1;
  89. $1=_st($JSON())._stringify_(self._asJSON());
  90. return $1;
  91. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},smalltalk.Object)})},
  92. args: [],
  93. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  94. messageSends: ["stringify:", "asJSON"],
  95. referencedClasses: ["JSON"]
  96. }),
  97. smalltalk.Object);
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "asJavascript",
  101. category: 'converting',
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) {
  105. var $1;
  106. $1=self._asString();
  107. return $1;
  108. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Object)})},
  109. args: [],
  110. source: "asJavascript\x0a\x09^self asString",
  111. messageSends: ["asString"],
  112. referencedClasses: []
  113. }),
  114. smalltalk.Object);
  115. smalltalk.addMethod(
  116. smalltalk.method({
  117. selector: "asString",
  118. category: 'converting',
  119. fn: function (){
  120. var self=this;
  121. return smalltalk.withContext(function($ctx1) {
  122. var $1;
  123. $1=self._printString();
  124. return $1;
  125. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Object)})},
  126. args: [],
  127. source: "asString\x0a\x09^self printString",
  128. messageSends: ["printString"],
  129. referencedClasses: []
  130. }),
  131. smalltalk.Object);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "basicAt:",
  135. category: 'accessing',
  136. fn: function (aString){
  137. var self=this;
  138. return smalltalk.withContext(function($ctx1) {
  139. return self[aString];
  140. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},smalltalk.Object)})},
  141. args: ["aString"],
  142. source: "basicAt: aString\x0a\x09<return self[aString]>",
  143. messageSends: [],
  144. referencedClasses: []
  145. }),
  146. smalltalk.Object);
  147. smalltalk.addMethod(
  148. smalltalk.method({
  149. selector: "basicAt:put:",
  150. category: 'accessing',
  151. fn: function (aString,anObject){
  152. var self=this;
  153. return smalltalk.withContext(function($ctx1) {
  154. return self[aString] = anObject;
  155. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  156. args: ["aString", "anObject"],
  157. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  158. messageSends: [],
  159. referencedClasses: []
  160. }),
  161. smalltalk.Object);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "basicDelete:",
  165. category: 'accessing',
  166. fn: function (aString){
  167. var self=this;
  168. return smalltalk.withContext(function($ctx1) {
  169. delete self[aString]; return aString;
  170. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},smalltalk.Object)})},
  171. args: ["aString"],
  172. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  173. messageSends: [],
  174. referencedClasses: []
  175. }),
  176. smalltalk.Object);
  177. smalltalk.addMethod(
  178. smalltalk.method({
  179. selector: "basicPerform:",
  180. category: 'message handling',
  181. fn: function (aString){
  182. var self=this;
  183. return smalltalk.withContext(function($ctx1) {
  184. var $1;
  185. $1=self._basicPerform_withArguments_(aString,[]);
  186. return $1;
  187. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},smalltalk.Object)})},
  188. args: ["aString"],
  189. source: "basicPerform: aString\x0a\x09^self basicPerform: aString withArguments: #()",
  190. messageSends: ["basicPerform:withArguments:"],
  191. referencedClasses: []
  192. }),
  193. smalltalk.Object);
  194. smalltalk.addMethod(
  195. smalltalk.method({
  196. selector: "basicPerform:withArguments:",
  197. category: 'message handling',
  198. fn: function (aString,aCollection){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) {
  201. return self[aString].apply(self, aCollection);;
  202. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  203. args: ["aString", "aCollection"],
  204. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  205. messageSends: [],
  206. referencedClasses: []
  207. }),
  208. smalltalk.Object);
  209. smalltalk.addMethod(
  210. smalltalk.method({
  211. selector: "class",
  212. category: 'accessing',
  213. fn: function (){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) {
  216. return self.klass;
  217. return self}, function($ctx1) {$ctx1.fill(self,"class",{},smalltalk.Object)})},
  218. args: [],
  219. source: "class\x0a\x09<return self.klass>",
  220. messageSends: [],
  221. referencedClasses: []
  222. }),
  223. smalltalk.Object);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "copy",
  227. category: 'copying',
  228. fn: function (){
  229. var self=this;
  230. return smalltalk.withContext(function($ctx1) {
  231. var $1;
  232. $1=_st(self._shallowCopy())._postCopy();
  233. return $1;
  234. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Object)})},
  235. args: [],
  236. source: "copy\x0a\x09^self shallowCopy postCopy",
  237. messageSends: ["postCopy", "shallowCopy"],
  238. referencedClasses: []
  239. }),
  240. smalltalk.Object);
  241. smalltalk.addMethod(
  242. smalltalk.method({
  243. selector: "deepCopy",
  244. category: 'copying',
  245. fn: function (){
  246. var self=this;
  247. return smalltalk.withContext(function($ctx1) {
  248. var copy = self.klass._new();
  249. for(var i in self) {
  250. if(/^@.+/.test(i)) {
  251. copy[i] = self[i]._deepCopy();
  252. }
  253. }
  254. return copy;
  255. ;
  256. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Object)})},
  257. args: [],
  258. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
  259. messageSends: [],
  260. referencedClasses: []
  261. }),
  262. smalltalk.Object);
  263. smalltalk.addMethod(
  264. smalltalk.method({
  265. selector: "deprecatedAPI",
  266. category: 'error handling',
  267. fn: function (){
  268. var self=this;
  269. return smalltalk.withContext(function($ctx1) {
  270. _st(console)._warn_(_st(_st(_st(_st(smalltalk.getThisContext()._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_st(smalltalk.getThisContext()._home())._home())._asString())).__comma(")"));
  271. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},smalltalk.Object)})},
  272. args: [],
  273. 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, ')'",
  274. messageSends: ["warn:", ",", "asString", "home"],
  275. referencedClasses: []
  276. }),
  277. smalltalk.Object);
  278. smalltalk.addMethod(
  279. smalltalk.method({
  280. selector: "doesNotUnderstand:",
  281. category: 'error handling',
  282. fn: function (aMessage){
  283. var self=this;
  284. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  285. return smalltalk.withContext(function($ctx1) {
  286. var $1,$2;
  287. $1=_st($MessageNotUnderstood())._new();
  288. _st($1)._receiver_(self);
  289. _st($1)._message_(aMessage);
  290. $2=_st($1)._signal();
  291. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.Object)})},
  292. args: ["aMessage"],
  293. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  294. messageSends: ["receiver:", "new", "message:", "signal"],
  295. referencedClasses: ["MessageNotUnderstood"]
  296. }),
  297. smalltalk.Object);
  298. smalltalk.addMethod(
  299. smalltalk.method({
  300. selector: "error:",
  301. category: 'error handling',
  302. fn: function (aString){
  303. var self=this;
  304. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  305. return smalltalk.withContext(function($ctx1) {
  306. _st($Error())._signal_(aString);
  307. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},smalltalk.Object)})},
  308. args: ["aString"],
  309. source: "error: aString\x0a\x09Error signal: aString",
  310. messageSends: ["signal:"],
  311. referencedClasses: ["Error"]
  312. }),
  313. smalltalk.Object);
  314. smalltalk.addMethod(
  315. smalltalk.method({
  316. selector: "halt",
  317. category: 'error handling',
  318. fn: function (){
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) {
  321. self._error_("Halt encountered");
  322. return self}, function($ctx1) {$ctx1.fill(self,"halt",{},smalltalk.Object)})},
  323. args: [],
  324. source: "halt\x0a\x09self error: 'Halt encountered'",
  325. messageSends: ["error:"],
  326. referencedClasses: []
  327. }),
  328. smalltalk.Object);
  329. smalltalk.addMethod(
  330. smalltalk.method({
  331. selector: "identityHash",
  332. category: 'accessing',
  333. fn: function (){
  334. var self=this;
  335. return smalltalk.withContext(function($ctx1) {
  336. var hash=self.identityHash;
  337. if (hash) return hash;
  338. hash=smalltalk.nextId();
  339. Object.defineProperty(self, 'identityHash', {value:hash});
  340. return hash;
  341. ;
  342. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Object)})},
  343. args: [],
  344. 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>",
  345. messageSends: [],
  346. referencedClasses: []
  347. }),
  348. smalltalk.Object);
  349. smalltalk.addMethod(
  350. smalltalk.method({
  351. selector: "ifNil:",
  352. category: 'testing',
  353. fn: function (aBlock){
  354. var self=this;
  355. return smalltalk.withContext(function($ctx1) {
  356. var $1;
  357. $1=self;
  358. return $1;
  359. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.Object)})},
  360. args: ["aBlock"],
  361. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  362. messageSends: [],
  363. referencedClasses: []
  364. }),
  365. smalltalk.Object);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "ifNil:ifNotNil:",
  369. category: 'testing',
  370. fn: function (aBlock,anotherBlock){
  371. var self=this;
  372. return smalltalk.withContext(function($ctx1) {
  373. var $1;
  374. $1=_st(anotherBlock)._value_(self);
  375. return $1;
  376. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  377. args: ["aBlock", "anotherBlock"],
  378. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value: self",
  379. messageSends: ["value:"],
  380. referencedClasses: []
  381. }),
  382. smalltalk.Object);
  383. smalltalk.addMethod(
  384. smalltalk.method({
  385. selector: "ifNotNil:",
  386. category: 'testing',
  387. fn: function (aBlock){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. var $1;
  391. $1=_st(aBlock)._value_(self);
  392. return $1;
  393. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.Object)})},
  394. args: ["aBlock"],
  395. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  396. messageSends: ["value:"],
  397. referencedClasses: []
  398. }),
  399. smalltalk.Object);
  400. smalltalk.addMethod(
  401. smalltalk.method({
  402. selector: "ifNotNil:ifNil:",
  403. category: 'testing',
  404. fn: function (aBlock,anotherBlock){
  405. var self=this;
  406. return smalltalk.withContext(function($ctx1) {
  407. var $1;
  408. $1=_st(aBlock)._value_(self);
  409. return $1;
  410. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  411. args: ["aBlock", "anotherBlock"],
  412. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  413. messageSends: ["value:"],
  414. referencedClasses: []
  415. }),
  416. smalltalk.Object);
  417. smalltalk.addMethod(
  418. smalltalk.method({
  419. selector: "initialize",
  420. category: 'initialization',
  421. fn: function (){
  422. var self=this;
  423. return smalltalk.withContext(function($ctx1) {
  424. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object)})},
  425. args: [],
  426. source: "initialize",
  427. messageSends: [],
  428. referencedClasses: []
  429. }),
  430. smalltalk.Object);
  431. smalltalk.addMethod(
  432. smalltalk.method({
  433. selector: "inspect",
  434. category: 'inspecting',
  435. fn: function (){
  436. var self=this;
  437. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  438. return smalltalk.withContext(function($ctx1) {
  439. _st($InspectorHandler())._inspect_(self);
  440. return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},smalltalk.Object)})},
  441. args: [],
  442. source: "inspect\x0a\x09InspectorHandler inspect: self",
  443. messageSends: ["inspect:"],
  444. referencedClasses: ["InspectorHandler"]
  445. }),
  446. smalltalk.Object);
  447. smalltalk.addMethod(
  448. smalltalk.method({
  449. selector: "inspectOn:",
  450. category: 'inspecting',
  451. fn: function (anInspector){
  452. var self=this;
  453. var variables;
  454. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  455. return smalltalk.withContext(function($ctx1) {
  456. var $1,$2;
  457. variables=_st($Dictionary())._new();
  458. _st(variables)._at_put_("#self",self);
  459. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  460. return smalltalk.withContext(function($ctx2) {
  461. return _st(variables)._at_put_(each,self._instVarAt_(each));
  462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  463. $1=anInspector;
  464. _st($1)._setLabel_(self._printString());
  465. $2=_st($1)._setVariables_(variables);
  466. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.Object)})},
  467. args: ["anInspector"],
  468. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [:each |\x0a\x09\x09variables at: each put: (self instVarAt: each)].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  469. messageSends: ["new", "at:put:", "do:", "instVarAt:", "allInstanceVariableNames", "class", "setLabel:", "printString", "setVariables:"],
  470. referencedClasses: ["Dictionary"]
  471. }),
  472. smalltalk.Object);
  473. smalltalk.addMethod(
  474. smalltalk.method({
  475. selector: "instVarAt:",
  476. category: 'accessing',
  477. fn: function (aString){
  478. var self=this;
  479. return smalltalk.withContext(function($ctx1) {
  480. return self['@'+aString] ;
  481. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})},
  482. args: ["aString"],
  483. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  484. messageSends: [],
  485. referencedClasses: []
  486. }),
  487. smalltalk.Object);
  488. smalltalk.addMethod(
  489. smalltalk.method({
  490. selector: "instVarAt:put:",
  491. category: 'accessing',
  492. fn: function (aString,anObject){
  493. var self=this;
  494. return smalltalk.withContext(function($ctx1) {
  495. self['@' + aString] = anObject ;
  496. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  497. args: ["aString", "anObject"],
  498. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  499. messageSends: [],
  500. referencedClasses: []
  501. }),
  502. smalltalk.Object);
  503. smalltalk.addMethod(
  504. smalltalk.method({
  505. selector: "isBehavior",
  506. category: 'testing',
  507. fn: function (){
  508. var self=this;
  509. return smalltalk.withContext(function($ctx1) {
  510. return false;
  511. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})},
  512. args: [],
  513. source: "isBehavior\x0a\x09^ false",
  514. messageSends: [],
  515. referencedClasses: []
  516. }),
  517. smalltalk.Object);
  518. smalltalk.addMethod(
  519. smalltalk.method({
  520. selector: "isBoolean",
  521. category: 'testing',
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) {
  525. return false;
  526. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})},
  527. args: [],
  528. source: "isBoolean\x0a\x09^ false",
  529. messageSends: [],
  530. referencedClasses: []
  531. }),
  532. smalltalk.Object);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "isClass",
  536. category: 'testing',
  537. fn: function (){
  538. var self=this;
  539. return smalltalk.withContext(function($ctx1) {
  540. return false;
  541. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})},
  542. args: [],
  543. source: "isClass\x0a\x09^false",
  544. messageSends: [],
  545. referencedClasses: []
  546. }),
  547. smalltalk.Object);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "isCompiledMethod",
  551. category: 'testing',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. return false;
  556. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})},
  557. args: [],
  558. source: "isCompiledMethod\x0a\x09^ false",
  559. messageSends: [],
  560. referencedClasses: []
  561. }),
  562. smalltalk.Object);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "isImmutable",
  566. category: 'testing',
  567. fn: function (){
  568. var self=this;
  569. return smalltalk.withContext(function($ctx1) {
  570. return false;
  571. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})},
  572. args: [],
  573. source: "isImmutable\x0a\x09^ false",
  574. messageSends: [],
  575. referencedClasses: []
  576. }),
  577. smalltalk.Object);
  578. smalltalk.addMethod(
  579. smalltalk.method({
  580. selector: "isKindOf:",
  581. category: 'testing',
  582. fn: function (aClass){
  583. var self=this;
  584. return smalltalk.withContext(function($ctx1) {
  585. var $2,$1;
  586. $2=self._isMemberOf_(aClass);
  587. if(smalltalk.assert($2)){
  588. $1=true;
  589. } else {
  590. $1=_st(self._class())._inheritsFrom_(aClass);
  591. };
  592. return $1;
  593. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})},
  594. args: ["aClass"],
  595. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]",
  596. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  597. referencedClasses: []
  598. }),
  599. smalltalk.Object);
  600. smalltalk.addMethod(
  601. smalltalk.method({
  602. selector: "isMemberOf:",
  603. category: 'testing',
  604. fn: function (aClass){
  605. var self=this;
  606. return smalltalk.withContext(function($ctx1) {
  607. var $1;
  608. $1=_st(self._class()).__eq(aClass);
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})},
  611. args: ["aClass"],
  612. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  613. messageSends: ["=", "class"],
  614. referencedClasses: []
  615. }),
  616. smalltalk.Object);
  617. smalltalk.addMethod(
  618. smalltalk.method({
  619. selector: "isMetaclass",
  620. category: 'testing',
  621. fn: function (){
  622. var self=this;
  623. return smalltalk.withContext(function($ctx1) {
  624. return false;
  625. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})},
  626. args: [],
  627. source: "isMetaclass\x0a\x09^false",
  628. messageSends: [],
  629. referencedClasses: []
  630. }),
  631. smalltalk.Object);
  632. smalltalk.addMethod(
  633. smalltalk.method({
  634. selector: "isNil",
  635. category: 'testing',
  636. fn: function (){
  637. var self=this;
  638. return smalltalk.withContext(function($ctx1) {
  639. return false;
  640. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})},
  641. args: [],
  642. source: "isNil\x0a\x09^false",
  643. messageSends: [],
  644. referencedClasses: []
  645. }),
  646. smalltalk.Object);
  647. smalltalk.addMethod(
  648. smalltalk.method({
  649. selector: "isNumber",
  650. category: 'testing',
  651. fn: function (){
  652. var self=this;
  653. return smalltalk.withContext(function($ctx1) {
  654. return false;
  655. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})},
  656. args: [],
  657. source: "isNumber\x0a\x09^false",
  658. messageSends: [],
  659. referencedClasses: []
  660. }),
  661. smalltalk.Object);
  662. smalltalk.addMethod(
  663. smalltalk.method({
  664. selector: "isPackage",
  665. category: 'testing',
  666. fn: function (){
  667. var self=this;
  668. return smalltalk.withContext(function($ctx1) {
  669. return false;
  670. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})},
  671. args: [],
  672. source: "isPackage\x0a\x09^ false",
  673. messageSends: [],
  674. referencedClasses: []
  675. }),
  676. smalltalk.Object);
  677. smalltalk.addMethod(
  678. smalltalk.method({
  679. selector: "isParseFailure",
  680. category: 'testing',
  681. fn: function (){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. return false;
  685. }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})},
  686. args: [],
  687. source: "isParseFailure\x0a\x09^false",
  688. messageSends: [],
  689. referencedClasses: []
  690. }),
  691. smalltalk.Object);
  692. smalltalk.addMethod(
  693. smalltalk.method({
  694. selector: "isString",
  695. category: 'testing',
  696. fn: function (){
  697. var self=this;
  698. return smalltalk.withContext(function($ctx1) {
  699. return false;
  700. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})},
  701. args: [],
  702. source: "isString\x0a\x09^false",
  703. messageSends: [],
  704. referencedClasses: []
  705. }),
  706. smalltalk.Object);
  707. smalltalk.addMethod(
  708. smalltalk.method({
  709. selector: "isSymbol",
  710. category: 'testing',
  711. fn: function (){
  712. var self=this;
  713. return smalltalk.withContext(function($ctx1) {
  714. return false;
  715. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})},
  716. args: [],
  717. source: "isSymbol\x0a\x09^false",
  718. messageSends: [],
  719. referencedClasses: []
  720. }),
  721. smalltalk.Object);
  722. smalltalk.addMethod(
  723. smalltalk.method({
  724. selector: "notNil",
  725. category: 'testing',
  726. fn: function (){
  727. var self=this;
  728. return smalltalk.withContext(function($ctx1) {
  729. var $1;
  730. $1=_st(self._isNil())._not();
  731. return $1;
  732. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})},
  733. args: [],
  734. source: "notNil\x0a\x09^self isNil not",
  735. messageSends: ["not", "isNil"],
  736. referencedClasses: []
  737. }),
  738. smalltalk.Object);
  739. smalltalk.addMethod(
  740. smalltalk.method({
  741. selector: "perform:",
  742. category: 'message handling',
  743. fn: function (aString){
  744. var self=this;
  745. return smalltalk.withContext(function($ctx1) {
  746. var $1;
  747. $1=self._perform_withArguments_(aString,[]);
  748. return $1;
  749. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})},
  750. args: ["aString"],
  751. source: "perform: aString\x0a\x09^self perform: aString withArguments: #()",
  752. messageSends: ["perform:withArguments:"],
  753. referencedClasses: []
  754. }),
  755. smalltalk.Object);
  756. smalltalk.addMethod(
  757. smalltalk.method({
  758. selector: "perform:withArguments:",
  759. category: 'message handling',
  760. fn: function (aString,aCollection){
  761. var self=this;
  762. return smalltalk.withContext(function($ctx1) {
  763. return smalltalk.send(self, aString._asSelector(), aCollection);
  764. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  765. args: ["aString", "aCollection"],
  766. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  767. messageSends: [],
  768. referencedClasses: []
  769. }),
  770. smalltalk.Object);
  771. smalltalk.addMethod(
  772. smalltalk.method({
  773. selector: "postCopy",
  774. category: 'copying',
  775. fn: function (){
  776. var self=this;
  777. return smalltalk.withContext(function($ctx1) {
  778. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})},
  779. args: [],
  780. source: "postCopy",
  781. messageSends: [],
  782. referencedClasses: []
  783. }),
  784. smalltalk.Object);
  785. smalltalk.addMethod(
  786. smalltalk.method({
  787. selector: "printOn:",
  788. category: 'printing',
  789. fn: function (aStream){
  790. var self=this;
  791. return smalltalk.withContext(function($ctx1) {
  792. var $1,$3,$2;
  793. $1=aStream;
  794. $3=_st(_st(_st(self._class())._name())._first())._isVowel();
  795. if(smalltalk.assert($3)){
  796. $2="an ";
  797. } else {
  798. $2="a ";
  799. };
  800. _st($1)._nextPutAll_($2);
  801. _st(aStream)._nextPutAll_(_st(self._class())._name());
  802. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})},
  803. args: ["aStream"],
  804. source: "printOn: aStream\x0a\x09\x22Append to the aStream, a string representing the receiver.\x22\x0a\x09\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  805. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  806. referencedClasses: []
  807. }),
  808. smalltalk.Object);
  809. smalltalk.addMethod(
  810. smalltalk.method({
  811. selector: "printString",
  812. category: 'printing',
  813. fn: function (){
  814. var self=this;
  815. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  816. return smalltalk.withContext(function($ctx1) {
  817. var $1;
  818. $1=_st($String())._streamContents_((function(stream){
  819. return smalltalk.withContext(function($ctx2) {
  820. return self._printOn_(stream);
  821. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  822. return $1;
  823. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})},
  824. args: [],
  825. source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]",
  826. messageSends: ["streamContents:", "printOn:"],
  827. referencedClasses: ["String"]
  828. }),
  829. smalltalk.Object);
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "putOn:",
  833. category: 'streaming',
  834. fn: function (aStream){
  835. var self=this;
  836. return smalltalk.withContext(function($ctx1) {
  837. _st(aStream)._nextPut_(self);
  838. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})},
  839. args: ["aStream"],
  840. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  841. messageSends: ["nextPut:"],
  842. referencedClasses: []
  843. }),
  844. smalltalk.Object);
  845. smalltalk.addMethod(
  846. smalltalk.method({
  847. selector: "respondsTo:",
  848. category: 'testing',
  849. fn: function (aSelector){
  850. var self=this;
  851. return smalltalk.withContext(function($ctx1) {
  852. var $1;
  853. $1=_st(self._class())._canUnderstand_(aSelector);
  854. return $1;
  855. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})},
  856. args: ["aSelector"],
  857. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  858. messageSends: ["canUnderstand:", "class"],
  859. referencedClasses: []
  860. }),
  861. smalltalk.Object);
  862. smalltalk.addMethod(
  863. smalltalk.method({
  864. selector: "shallowCopy",
  865. category: 'copying',
  866. fn: function (){
  867. var self=this;
  868. return smalltalk.withContext(function($ctx1) {
  869. var copy = self.klass._new();
  870. for(var i in self) {
  871. if(/^@.+/.test(i)) {
  872. copy[i] = self[i];
  873. }
  874. }
  875. return copy;
  876. ;
  877. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})},
  878. args: [],
  879. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
  880. messageSends: [],
  881. referencedClasses: []
  882. }),
  883. smalltalk.Object);
  884. smalltalk.addMethod(
  885. smalltalk.method({
  886. selector: "shouldNotImplement",
  887. category: 'error handling',
  888. fn: function (){
  889. var self=this;
  890. return smalltalk.withContext(function($ctx1) {
  891. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  892. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})},
  893. args: [],
  894. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  895. messageSends: ["error:", ",", "name", "class"],
  896. referencedClasses: []
  897. }),
  898. smalltalk.Object);
  899. smalltalk.addMethod(
  900. smalltalk.method({
  901. selector: "size",
  902. category: 'accessing',
  903. fn: function (){
  904. var self=this;
  905. return smalltalk.withContext(function($ctx1) {
  906. self._error_("Object not indexable");
  907. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})},
  908. args: [],
  909. source: "size\x0a\x09self error: 'Object not indexable'",
  910. messageSends: ["error:"],
  911. referencedClasses: []
  912. }),
  913. smalltalk.Object);
  914. smalltalk.addMethod(
  915. smalltalk.method({
  916. selector: "subclassResponsibility",
  917. category: 'error handling',
  918. fn: function (){
  919. var self=this;
  920. return smalltalk.withContext(function($ctx1) {
  921. self._error_("This method is a responsibility of a subclass");
  922. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})},
  923. args: [],
  924. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  925. messageSends: ["error:"],
  926. referencedClasses: []
  927. }),
  928. smalltalk.Object);
  929. smalltalk.addMethod(
  930. smalltalk.method({
  931. selector: "test",
  932. category: 'converting',
  933. fn: function (){
  934. var self=this;
  935. var a;
  936. return smalltalk.withContext(function($ctx1) {
  937. a=(1);
  938. self._halt();
  939. return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})},
  940. args: [],
  941. source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt",
  942. messageSends: ["halt"],
  943. referencedClasses: []
  944. }),
  945. smalltalk.Object);
  946. smalltalk.addMethod(
  947. smalltalk.method({
  948. selector: "throw:",
  949. category: 'error handling',
  950. fn: function (anObject){
  951. var self=this;
  952. return smalltalk.withContext(function($ctx1) {
  953. throw anObject ;
  954. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})},
  955. args: ["anObject"],
  956. source: "throw: anObject\x0a\x09< throw anObject >",
  957. messageSends: [],
  958. referencedClasses: []
  959. }),
  960. smalltalk.Object);
  961. smalltalk.addMethod(
  962. smalltalk.method({
  963. selector: "try:catch:",
  964. category: 'error handling',
  965. fn: function (aBlock,anotherBlock){
  966. var self=this;
  967. return smalltalk.withContext(function($ctx1) {
  968. try{return aBlock()} catch(e) {return anotherBlock(e)};
  969. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  970. args: ["aBlock", "anotherBlock"],
  971. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock()} catch(e) {return anotherBlock(e)}>",
  972. messageSends: [],
  973. referencedClasses: []
  974. }),
  975. smalltalk.Object);
  976. smalltalk.addMethod(
  977. smalltalk.method({
  978. selector: "value",
  979. category: 'accessing',
  980. fn: function (){
  981. var self=this;
  982. return smalltalk.withContext(function($ctx1) {
  983. return self.valueOf();
  984. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})},
  985. args: [],
  986. source: "value\x0a\x09<return self.valueOf()>",
  987. messageSends: [],
  988. referencedClasses: []
  989. }),
  990. smalltalk.Object);
  991. smalltalk.addMethod(
  992. smalltalk.method({
  993. selector: "yourself",
  994. category: 'accessing',
  995. fn: function (){
  996. var self=this;
  997. return smalltalk.withContext(function($ctx1) {
  998. var $1;
  999. $1=self;
  1000. return $1;
  1001. }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})},
  1002. args: [],
  1003. source: "yourself\x0a\x09^self",
  1004. messageSends: [],
  1005. referencedClasses: []
  1006. }),
  1007. smalltalk.Object);
  1008. smalltalk.addMethod(
  1009. smalltalk.method({
  1010. selector: "~=",
  1011. category: 'comparing',
  1012. fn: function (anObject){
  1013. var self=this;
  1014. return smalltalk.withContext(function($ctx1) {
  1015. var $1;
  1016. $1=_st(self.__eq(anObject)).__eq(false);
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})},
  1019. args: ["anObject"],
  1020. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1021. messageSends: ["="],
  1022. referencedClasses: []
  1023. }),
  1024. smalltalk.Object);
  1025. smalltalk.addMethod(
  1026. smalltalk.method({
  1027. selector: "~~",
  1028. category: 'comparing',
  1029. fn: function (anObject){
  1030. var self=this;
  1031. return smalltalk.withContext(function($ctx1) {
  1032. var $1;
  1033. $1=_st(self.__eq_eq(anObject)).__eq(false);
  1034. return $1;
  1035. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})},
  1036. args: ["anObject"],
  1037. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1038. messageSends: ["=", "=="],
  1039. referencedClasses: []
  1040. }),
  1041. smalltalk.Object);
  1042. smalltalk.addMethod(
  1043. smalltalk.method({
  1044. selector: "heliosClass",
  1045. category: 'helios',
  1046. fn: function (){
  1047. var self=this;
  1048. return smalltalk.withContext(function($ctx1) {
  1049. return "class";
  1050. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Object.klass)})},
  1051. args: [],
  1052. source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
  1053. messageSends: [],
  1054. referencedClasses: []
  1055. }),
  1056. smalltalk.Object.klass);
  1057. smalltalk.addMethod(
  1058. smalltalk.method({
  1059. selector: "initialize",
  1060. category: 'initialization',
  1061. fn: function (){
  1062. var self=this;
  1063. return smalltalk.withContext(function($ctx1) {
  1064. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})},
  1065. args: [],
  1066. source: "initialize\x0a\x09\x22no op\x22",
  1067. messageSends: [],
  1068. referencedClasses: []
  1069. }),
  1070. smalltalk.Object.klass);
  1071. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1072. smalltalk.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  1073. smalltalk.addMethod(
  1074. smalltalk.method({
  1075. selector: "&",
  1076. category: 'controlling',
  1077. fn: function (aBoolean){
  1078. var self=this;
  1079. return smalltalk.withContext(function($ctx1) {
  1080. if(self == true) {
  1081. return aBoolean;
  1082. } else {
  1083. return false;
  1084. }
  1085. ;
  1086. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1087. args: ["aBoolean"],
  1088. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  1089. messageSends: [],
  1090. referencedClasses: []
  1091. }),
  1092. smalltalk.Boolean);
  1093. smalltalk.addMethod(
  1094. smalltalk.method({
  1095. selector: "=",
  1096. category: 'comparing',
  1097. fn: function (aBoolean){
  1098. var self=this;
  1099. return smalltalk.withContext(function($ctx1) {
  1100. if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
  1101. return false;
  1102. }
  1103. return Boolean(self == true) == aBoolean
  1104. ;
  1105. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1106. args: ["aBoolean"],
  1107. source: "= aBoolean\x0a\x09<\x0a\x09\x09if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Boolean(self == true) == aBoolean\x0a\x09>",
  1108. messageSends: [],
  1109. referencedClasses: []
  1110. }),
  1111. smalltalk.Boolean);
  1112. smalltalk.addMethod(
  1113. smalltalk.method({
  1114. selector: "==",
  1115. category: 'comparing',
  1116. fn: function (aBoolean){
  1117. var self=this;
  1118. return smalltalk.withContext(function($ctx1) {
  1119. var $1;
  1120. $1=self.__eq(aBoolean);
  1121. return $1;
  1122. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1123. args: ["aBoolean"],
  1124. source: "== aBoolean\x0a\x09^self = aBoolean",
  1125. messageSends: ["="],
  1126. referencedClasses: []
  1127. }),
  1128. smalltalk.Boolean);
  1129. smalltalk.addMethod(
  1130. smalltalk.method({
  1131. selector: "and:",
  1132. category: 'controlling',
  1133. fn: function (aBlock){
  1134. var self=this;
  1135. return smalltalk.withContext(function($ctx1) {
  1136. var $2,$1;
  1137. $2=self.__eq(true);
  1138. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1139. return smalltalk.withContext(function($ctx2) {
  1140. return false;
  1141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1142. return $1;
  1143. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})},
  1144. args: ["aBlock"],
  1145. source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]",
  1146. messageSends: ["ifTrue:ifFalse:", "="],
  1147. referencedClasses: []
  1148. }),
  1149. smalltalk.Boolean);
  1150. smalltalk.addMethod(
  1151. smalltalk.method({
  1152. selector: "asBit",
  1153. category: 'converting',
  1154. fn: function (){
  1155. var self=this;
  1156. return smalltalk.withContext(function($ctx1) {
  1157. var $2,$1;
  1158. $2=self;
  1159. if(smalltalk.assert($2)){
  1160. $1=(1);
  1161. } else {
  1162. $1=(0);
  1163. };
  1164. return $1;
  1165. }, function($ctx1) {$ctx1.fill(self,"asBit",{},smalltalk.Boolean)})},
  1166. args: [],
  1167. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  1168. messageSends: ["ifTrue:ifFalse:"],
  1169. referencedClasses: []
  1170. }),
  1171. smalltalk.Boolean);
  1172. smalltalk.addMethod(
  1173. smalltalk.method({
  1174. selector: "asJSON",
  1175. category: 'converting',
  1176. fn: function (){
  1177. var self=this;
  1178. return smalltalk.withContext(function($ctx1) {
  1179. var $1;
  1180. $1=self;
  1181. return $1;
  1182. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})},
  1183. args: [],
  1184. source: "asJSON\x0a\x09^self",
  1185. messageSends: [],
  1186. referencedClasses: []
  1187. }),
  1188. smalltalk.Boolean);
  1189. smalltalk.addMethod(
  1190. smalltalk.method({
  1191. selector: "asString",
  1192. category: 'converting',
  1193. fn: function (){
  1194. var self=this;
  1195. return smalltalk.withContext(function($ctx1) {
  1196. return self.toString() ;
  1197. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})},
  1198. args: [],
  1199. source: "asString\x0a\x09< return self.toString() >",
  1200. messageSends: [],
  1201. referencedClasses: []
  1202. }),
  1203. smalltalk.Boolean);
  1204. smalltalk.addMethod(
  1205. smalltalk.method({
  1206. selector: "deepCopy",
  1207. category: 'copying',
  1208. fn: function (){
  1209. var self=this;
  1210. return smalltalk.withContext(function($ctx1) {
  1211. var $1;
  1212. $1=self;
  1213. return $1;
  1214. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})},
  1215. args: [],
  1216. source: "deepCopy\x0a\x09^self",
  1217. messageSends: [],
  1218. referencedClasses: []
  1219. }),
  1220. smalltalk.Boolean);
  1221. smalltalk.addMethod(
  1222. smalltalk.method({
  1223. selector: "ifFalse:",
  1224. category: 'controlling',
  1225. fn: function (aBlock){
  1226. var self=this;
  1227. return smalltalk.withContext(function($ctx1) {
  1228. var $2,$1;
  1229. $2=self;
  1230. $1=_st($2)._ifTrue_ifFalse_((function(){
  1231. return smalltalk.withContext(function($ctx2) {
  1232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1233. return $1;
  1234. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})},
  1235. args: ["aBlock"],
  1236. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1237. messageSends: ["ifTrue:ifFalse:"],
  1238. referencedClasses: []
  1239. }),
  1240. smalltalk.Boolean);
  1241. smalltalk.addMethod(
  1242. smalltalk.method({
  1243. selector: "ifFalse:ifTrue:",
  1244. category: 'controlling',
  1245. fn: function (aBlock,anotherBlock){
  1246. var self=this;
  1247. return smalltalk.withContext(function($ctx1) {
  1248. var $2,$1;
  1249. $2=self;
  1250. $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
  1251. return $1;
  1252. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1253. args: ["aBlock", "anotherBlock"],
  1254. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1255. messageSends: ["ifTrue:ifFalse:"],
  1256. referencedClasses: []
  1257. }),
  1258. smalltalk.Boolean);
  1259. smalltalk.addMethod(
  1260. smalltalk.method({
  1261. selector: "ifTrue:",
  1262. category: 'controlling',
  1263. fn: function (aBlock){
  1264. var self=this;
  1265. return smalltalk.withContext(function($ctx1) {
  1266. var $2,$1;
  1267. $2=self;
  1268. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1269. return smalltalk.withContext(function($ctx2) {
  1270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1271. return $1;
  1272. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})},
  1273. args: ["aBlock"],
  1274. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1275. messageSends: ["ifTrue:ifFalse:"],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.Boolean);
  1279. smalltalk.addMethod(
  1280. smalltalk.method({
  1281. selector: "ifTrue:ifFalse:",
  1282. category: 'controlling',
  1283. fn: function (aBlock,anotherBlock){
  1284. var self=this;
  1285. return smalltalk.withContext(function($ctx1) {
  1286. if(self == true) {
  1287. return aBlock();
  1288. } else {
  1289. return anotherBlock();
  1290. }
  1291. ;
  1292. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1293. args: ["aBlock", "anotherBlock"],
  1294. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock();\x0a\x09\x09}\x0a\x09>",
  1295. messageSends: [],
  1296. referencedClasses: []
  1297. }),
  1298. smalltalk.Boolean);
  1299. smalltalk.addMethod(
  1300. smalltalk.method({
  1301. selector: "isBoolean",
  1302. category: 'testing',
  1303. fn: function (){
  1304. var self=this;
  1305. return smalltalk.withContext(function($ctx1) {
  1306. return true;
  1307. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})},
  1308. args: [],
  1309. source: "isBoolean\x0a\x09^ true",
  1310. messageSends: [],
  1311. referencedClasses: []
  1312. }),
  1313. smalltalk.Boolean);
  1314. smalltalk.addMethod(
  1315. smalltalk.method({
  1316. selector: "isImmutable",
  1317. category: 'testing',
  1318. fn: function (){
  1319. var self=this;
  1320. return smalltalk.withContext(function($ctx1) {
  1321. return true;
  1322. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})},
  1323. args: [],
  1324. source: "isImmutable\x0a\x09^ true",
  1325. messageSends: [],
  1326. referencedClasses: []
  1327. }),
  1328. smalltalk.Boolean);
  1329. smalltalk.addMethod(
  1330. smalltalk.method({
  1331. selector: "not",
  1332. category: 'controlling',
  1333. fn: function (){
  1334. var self=this;
  1335. return smalltalk.withContext(function($ctx1) {
  1336. var $1;
  1337. $1=self.__eq(false);
  1338. return $1;
  1339. }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})},
  1340. args: [],
  1341. source: "not\x0a\x09^self = false",
  1342. messageSends: ["="],
  1343. referencedClasses: []
  1344. }),
  1345. smalltalk.Boolean);
  1346. smalltalk.addMethod(
  1347. smalltalk.method({
  1348. selector: "or:",
  1349. category: 'controlling',
  1350. fn: function (aBlock){
  1351. var self=this;
  1352. return smalltalk.withContext(function($ctx1) {
  1353. var $2,$1;
  1354. $2=self.__eq(true);
  1355. $1=_st($2)._ifTrue_ifFalse_((function(){
  1356. return smalltalk.withContext(function($ctx2) {
  1357. return true;
  1358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1359. return $1;
  1360. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})},
  1361. args: ["aBlock"],
  1362. source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock",
  1363. messageSends: ["ifTrue:ifFalse:", "="],
  1364. referencedClasses: []
  1365. }),
  1366. smalltalk.Boolean);
  1367. smalltalk.addMethod(
  1368. smalltalk.method({
  1369. selector: "printOn:",
  1370. category: 'printing',
  1371. fn: function (aStream){
  1372. var self=this;
  1373. return smalltalk.withContext(function($ctx1) {
  1374. _st(aStream)._nextPutAll_(self._asString());
  1375. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})},
  1376. args: ["aStream"],
  1377. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  1378. messageSends: ["nextPutAll:", "asString"],
  1379. referencedClasses: []
  1380. }),
  1381. smalltalk.Boolean);
  1382. smalltalk.addMethod(
  1383. smalltalk.method({
  1384. selector: "shallowCopy",
  1385. category: 'copying',
  1386. fn: function (){
  1387. var self=this;
  1388. return smalltalk.withContext(function($ctx1) {
  1389. var $1;
  1390. $1=self;
  1391. return $1;
  1392. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})},
  1393. args: [],
  1394. source: "shallowCopy\x0a\x09^self",
  1395. messageSends: [],
  1396. referencedClasses: []
  1397. }),
  1398. smalltalk.Boolean);
  1399. smalltalk.addMethod(
  1400. smalltalk.method({
  1401. selector: "|",
  1402. category: 'controlling',
  1403. fn: function (aBoolean){
  1404. var self=this;
  1405. return smalltalk.withContext(function($ctx1) {
  1406. if(self == true) {
  1407. return true;
  1408. } else {
  1409. return aBoolean;
  1410. }
  1411. ;
  1412. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1413. args: ["aBoolean"],
  1414. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  1415. messageSends: [],
  1416. referencedClasses: []
  1417. }),
  1418. smalltalk.Boolean);
  1419. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1420. smalltalk.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  1421. smalltalk.addMethod(
  1422. smalltalk.method({
  1423. selector: "+",
  1424. category: 'arithmetic',
  1425. fn: function (aDate){
  1426. var self=this;
  1427. return smalltalk.withContext(function($ctx1) {
  1428. return self + aDate;
  1429. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})},
  1430. args: ["aDate"],
  1431. source: "+ aDate\x0a\x09<return self + aDate>",
  1432. messageSends: [],
  1433. referencedClasses: []
  1434. }),
  1435. smalltalk.Date);
  1436. smalltalk.addMethod(
  1437. smalltalk.method({
  1438. selector: "-",
  1439. category: 'arithmetic',
  1440. fn: function (aDate){
  1441. var self=this;
  1442. return smalltalk.withContext(function($ctx1) {
  1443. return self - aDate;
  1444. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})},
  1445. args: ["aDate"],
  1446. source: "- aDate\x0a\x09<return self - aDate>",
  1447. messageSends: [],
  1448. referencedClasses: []
  1449. }),
  1450. smalltalk.Date);
  1451. smalltalk.addMethod(
  1452. smalltalk.method({
  1453. selector: "<",
  1454. category: 'comparing',
  1455. fn: function (aDate){
  1456. var self=this;
  1457. return smalltalk.withContext(function($ctx1) {
  1458. return self < aDate;
  1459. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})},
  1460. args: ["aDate"],
  1461. source: "< aDate\x0a\x09<return self < aDate>",
  1462. messageSends: [],
  1463. referencedClasses: []
  1464. }),
  1465. smalltalk.Date);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "<=",
  1469. category: 'comparing',
  1470. fn: function (aDate){
  1471. var self=this;
  1472. return smalltalk.withContext(function($ctx1) {
  1473. return self <= aDate;
  1474. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})},
  1475. args: ["aDate"],
  1476. source: "<= aDate\x0a\x09<return self <= aDate>",
  1477. messageSends: [],
  1478. referencedClasses: []
  1479. }),
  1480. smalltalk.Date);
  1481. smalltalk.addMethod(
  1482. smalltalk.method({
  1483. selector: ">",
  1484. category: 'comparing',
  1485. fn: function (aDate){
  1486. var self=this;
  1487. return smalltalk.withContext(function($ctx1) {
  1488. return self > aDate;
  1489. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})},
  1490. args: ["aDate"],
  1491. source: "> aDate\x0a\x09<return self >> aDate>",
  1492. messageSends: [],
  1493. referencedClasses: []
  1494. }),
  1495. smalltalk.Date);
  1496. smalltalk.addMethod(
  1497. smalltalk.method({
  1498. selector: ">=",
  1499. category: 'comparing',
  1500. fn: function (aDate){
  1501. var self=this;
  1502. return smalltalk.withContext(function($ctx1) {
  1503. return self >= aDate;
  1504. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})},
  1505. args: ["aDate"],
  1506. source: ">= aDate\x0a\x09<return self >>= aDate>",
  1507. messageSends: [],
  1508. referencedClasses: []
  1509. }),
  1510. smalltalk.Date);
  1511. smalltalk.addMethod(
  1512. smalltalk.method({
  1513. selector: "asDateString",
  1514. category: 'converting',
  1515. fn: function (){
  1516. var self=this;
  1517. return smalltalk.withContext(function($ctx1) {
  1518. return self.toDateString();
  1519. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})},
  1520. args: [],
  1521. source: "asDateString\x0a\x09<return self.toDateString()>",
  1522. messageSends: [],
  1523. referencedClasses: []
  1524. }),
  1525. smalltalk.Date);
  1526. smalltalk.addMethod(
  1527. smalltalk.method({
  1528. selector: "asLocaleString",
  1529. category: 'converting',
  1530. fn: function (){
  1531. var self=this;
  1532. return smalltalk.withContext(function($ctx1) {
  1533. return self.toLocaleString();
  1534. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})},
  1535. args: [],
  1536. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  1537. messageSends: [],
  1538. referencedClasses: []
  1539. }),
  1540. smalltalk.Date);
  1541. smalltalk.addMethod(
  1542. smalltalk.method({
  1543. selector: "asMilliseconds",
  1544. category: 'converting',
  1545. fn: function (){
  1546. var self=this;
  1547. return smalltalk.withContext(function($ctx1) {
  1548. var $1;
  1549. $1=self._time();
  1550. return $1;
  1551. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})},
  1552. args: [],
  1553. source: "asMilliseconds\x0a\x09^self time",
  1554. messageSends: ["time"],
  1555. referencedClasses: []
  1556. }),
  1557. smalltalk.Date);
  1558. smalltalk.addMethod(
  1559. smalltalk.method({
  1560. selector: "asNumber",
  1561. category: 'converting',
  1562. fn: function (){
  1563. var self=this;
  1564. return smalltalk.withContext(function($ctx1) {
  1565. var $1;
  1566. $1=self._asMilliseconds();
  1567. return $1;
  1568. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})},
  1569. args: [],
  1570. source: "asNumber\x0a\x09^self asMilliseconds",
  1571. messageSends: ["asMilliseconds"],
  1572. referencedClasses: []
  1573. }),
  1574. smalltalk.Date);
  1575. smalltalk.addMethod(
  1576. smalltalk.method({
  1577. selector: "asString",
  1578. category: 'converting',
  1579. fn: function (){
  1580. var self=this;
  1581. return smalltalk.withContext(function($ctx1) {
  1582. return self.toString();
  1583. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})},
  1584. args: [],
  1585. source: "asString\x0a\x09<return self.toString()>",
  1586. messageSends: [],
  1587. referencedClasses: []
  1588. }),
  1589. smalltalk.Date);
  1590. smalltalk.addMethod(
  1591. smalltalk.method({
  1592. selector: "asTimeString",
  1593. category: 'converting',
  1594. fn: function (){
  1595. var self=this;
  1596. return smalltalk.withContext(function($ctx1) {
  1597. return self.toTimeString();
  1598. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})},
  1599. args: [],
  1600. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  1601. messageSends: [],
  1602. referencedClasses: []
  1603. }),
  1604. smalltalk.Date);
  1605. smalltalk.addMethod(
  1606. smalltalk.method({
  1607. selector: "day",
  1608. category: 'accessing',
  1609. fn: function (){
  1610. var self=this;
  1611. return smalltalk.withContext(function($ctx1) {
  1612. var $1;
  1613. $1=self._dayOfWeek();
  1614. return $1;
  1615. }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})},
  1616. args: [],
  1617. source: "day\x0a\x09^self dayOfWeek",
  1618. messageSends: ["dayOfWeek"],
  1619. referencedClasses: []
  1620. }),
  1621. smalltalk.Date);
  1622. smalltalk.addMethod(
  1623. smalltalk.method({
  1624. selector: "day:",
  1625. category: 'accessing',
  1626. fn: function (aNumber){
  1627. var self=this;
  1628. return smalltalk.withContext(function($ctx1) {
  1629. self._dayOfWeek_(aNumber);
  1630. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})},
  1631. args: ["aNumber"],
  1632. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  1633. messageSends: ["dayOfWeek:"],
  1634. referencedClasses: []
  1635. }),
  1636. smalltalk.Date);
  1637. smalltalk.addMethod(
  1638. smalltalk.method({
  1639. selector: "dayOfMonth",
  1640. category: 'accessing',
  1641. fn: function (){
  1642. var self=this;
  1643. return smalltalk.withContext(function($ctx1) {
  1644. return self.getDate();
  1645. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})},
  1646. args: [],
  1647. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  1648. messageSends: [],
  1649. referencedClasses: []
  1650. }),
  1651. smalltalk.Date);
  1652. smalltalk.addMethod(
  1653. smalltalk.method({
  1654. selector: "dayOfMonth:",
  1655. category: 'accessing',
  1656. fn: function (aNumber){
  1657. var self=this;
  1658. return smalltalk.withContext(function($ctx1) {
  1659. self.setDate(aNumber);
  1660. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})},
  1661. args: ["aNumber"],
  1662. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  1663. messageSends: [],
  1664. referencedClasses: []
  1665. }),
  1666. smalltalk.Date);
  1667. smalltalk.addMethod(
  1668. smalltalk.method({
  1669. selector: "dayOfWeek",
  1670. category: 'accessing',
  1671. fn: function (){
  1672. var self=this;
  1673. return smalltalk.withContext(function($ctx1) {
  1674. return self.getDay() + 1;
  1675. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})},
  1676. args: [],
  1677. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  1678. messageSends: [],
  1679. referencedClasses: []
  1680. }),
  1681. smalltalk.Date);
  1682. smalltalk.addMethod(
  1683. smalltalk.method({
  1684. selector: "dayOfWeek:",
  1685. category: 'accessing',
  1686. fn: function (aNumber){
  1687. var self=this;
  1688. return smalltalk.withContext(function($ctx1) {
  1689. return self.setDay(aNumber - 1);
  1690. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})},
  1691. args: ["aNumber"],
  1692. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  1693. messageSends: [],
  1694. referencedClasses: []
  1695. }),
  1696. smalltalk.Date);
  1697. smalltalk.addMethod(
  1698. smalltalk.method({
  1699. selector: "hours",
  1700. category: 'accessing',
  1701. fn: function (){
  1702. var self=this;
  1703. return smalltalk.withContext(function($ctx1) {
  1704. return self.getHours();
  1705. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})},
  1706. args: [],
  1707. source: "hours\x0a\x09<return self.getHours()>",
  1708. messageSends: [],
  1709. referencedClasses: []
  1710. }),
  1711. smalltalk.Date);
  1712. smalltalk.addMethod(
  1713. smalltalk.method({
  1714. selector: "hours:",
  1715. category: 'accessing',
  1716. fn: function (aNumber){
  1717. var self=this;
  1718. return smalltalk.withContext(function($ctx1) {
  1719. self.setHours(aNumber);
  1720. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})},
  1721. args: ["aNumber"],
  1722. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  1723. messageSends: [],
  1724. referencedClasses: []
  1725. }),
  1726. smalltalk.Date);
  1727. smalltalk.addMethod(
  1728. smalltalk.method({
  1729. selector: "milliseconds",
  1730. category: 'accessing',
  1731. fn: function (){
  1732. var self=this;
  1733. return smalltalk.withContext(function($ctx1) {
  1734. return self.getMilliseconds();
  1735. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})},
  1736. args: [],
  1737. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  1738. messageSends: [],
  1739. referencedClasses: []
  1740. }),
  1741. smalltalk.Date);
  1742. smalltalk.addMethod(
  1743. smalltalk.method({
  1744. selector: "milliseconds:",
  1745. category: 'accessing',
  1746. fn: function (aNumber){
  1747. var self=this;
  1748. return smalltalk.withContext(function($ctx1) {
  1749. self.setMilliseconds(aNumber);
  1750. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})},
  1751. args: ["aNumber"],
  1752. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  1753. messageSends: [],
  1754. referencedClasses: []
  1755. }),
  1756. smalltalk.Date);
  1757. smalltalk.addMethod(
  1758. smalltalk.method({
  1759. selector: "minutes",
  1760. category: 'accessing',
  1761. fn: function (){
  1762. var self=this;
  1763. return smalltalk.withContext(function($ctx1) {
  1764. return self.getMinutes();
  1765. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})},
  1766. args: [],
  1767. source: "minutes\x0a\x09<return self.getMinutes()>",
  1768. messageSends: [],
  1769. referencedClasses: []
  1770. }),
  1771. smalltalk.Date);
  1772. smalltalk.addMethod(
  1773. smalltalk.method({
  1774. selector: "minutes:",
  1775. category: 'accessing',
  1776. fn: function (aNumber){
  1777. var self=this;
  1778. return smalltalk.withContext(function($ctx1) {
  1779. self.setMinutes(aNumber);
  1780. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})},
  1781. args: ["aNumber"],
  1782. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  1783. messageSends: [],
  1784. referencedClasses: []
  1785. }),
  1786. smalltalk.Date);
  1787. smalltalk.addMethod(
  1788. smalltalk.method({
  1789. selector: "month",
  1790. category: 'accessing',
  1791. fn: function (){
  1792. var self=this;
  1793. return smalltalk.withContext(function($ctx1) {
  1794. return self.getMonth() + 1;
  1795. return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})},
  1796. args: [],
  1797. source: "month\x0a\x09<return self.getMonth() + 1>",
  1798. messageSends: [],
  1799. referencedClasses: []
  1800. }),
  1801. smalltalk.Date);
  1802. smalltalk.addMethod(
  1803. smalltalk.method({
  1804. selector: "month:",
  1805. category: 'accessing',
  1806. fn: function (aNumber){
  1807. var self=this;
  1808. return smalltalk.withContext(function($ctx1) {
  1809. self.setMonth(aNumber - 1);
  1810. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})},
  1811. args: ["aNumber"],
  1812. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  1813. messageSends: [],
  1814. referencedClasses: []
  1815. }),
  1816. smalltalk.Date);
  1817. smalltalk.addMethod(
  1818. smalltalk.method({
  1819. selector: "printOn:",
  1820. category: 'printing',
  1821. fn: function (aStream){
  1822. var self=this;
  1823. return smalltalk.withContext(function($ctx1) {
  1824. _st(aStream)._nextPutAll_(self._asString());
  1825. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})},
  1826. args: ["aStream"],
  1827. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  1828. messageSends: ["nextPutAll:", "asString"],
  1829. referencedClasses: []
  1830. }),
  1831. smalltalk.Date);
  1832. smalltalk.addMethod(
  1833. smalltalk.method({
  1834. selector: "seconds",
  1835. category: 'accessing',
  1836. fn: function (){
  1837. var self=this;
  1838. return smalltalk.withContext(function($ctx1) {
  1839. return self.getSeconds();
  1840. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})},
  1841. args: [],
  1842. source: "seconds\x0a\x09<return self.getSeconds()>",
  1843. messageSends: [],
  1844. referencedClasses: []
  1845. }),
  1846. smalltalk.Date);
  1847. smalltalk.addMethod(
  1848. smalltalk.method({
  1849. selector: "seconds:",
  1850. category: 'accessing',
  1851. fn: function (aNumber){
  1852. var self=this;
  1853. return smalltalk.withContext(function($ctx1) {
  1854. self.setSeconds(aNumber);
  1855. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})},
  1856. args: ["aNumber"],
  1857. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  1858. messageSends: [],
  1859. referencedClasses: []
  1860. }),
  1861. smalltalk.Date);
  1862. smalltalk.addMethod(
  1863. smalltalk.method({
  1864. selector: "time",
  1865. category: 'accessing',
  1866. fn: function (){
  1867. var self=this;
  1868. return smalltalk.withContext(function($ctx1) {
  1869. return self.getTime();
  1870. return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})},
  1871. args: [],
  1872. source: "time\x0a\x09<return self.getTime()>",
  1873. messageSends: [],
  1874. referencedClasses: []
  1875. }),
  1876. smalltalk.Date);
  1877. smalltalk.addMethod(
  1878. smalltalk.method({
  1879. selector: "time:",
  1880. category: 'accessing',
  1881. fn: function (aNumber){
  1882. var self=this;
  1883. return smalltalk.withContext(function($ctx1) {
  1884. self.setTime(aNumber);
  1885. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})},
  1886. args: ["aNumber"],
  1887. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  1888. messageSends: [],
  1889. referencedClasses: []
  1890. }),
  1891. smalltalk.Date);
  1892. smalltalk.addMethod(
  1893. smalltalk.method({
  1894. selector: "year",
  1895. category: 'accessing',
  1896. fn: function (){
  1897. var self=this;
  1898. return smalltalk.withContext(function($ctx1) {
  1899. return self.getFullYear();
  1900. return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})},
  1901. args: [],
  1902. source: "year\x0a\x09<return self.getFullYear()>",
  1903. messageSends: [],
  1904. referencedClasses: []
  1905. }),
  1906. smalltalk.Date);
  1907. smalltalk.addMethod(
  1908. smalltalk.method({
  1909. selector: "year:",
  1910. category: 'accessing',
  1911. fn: function (aNumber){
  1912. var self=this;
  1913. return smalltalk.withContext(function($ctx1) {
  1914. self.setFullYear(aNumber);
  1915. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})},
  1916. args: ["aNumber"],
  1917. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  1918. messageSends: [],
  1919. referencedClasses: []
  1920. }),
  1921. smalltalk.Date);
  1922. smalltalk.addMethod(
  1923. smalltalk.method({
  1924. selector: "fromMilliseconds:",
  1925. category: 'instance creation',
  1926. fn: function (aNumber){
  1927. var self=this;
  1928. return smalltalk.withContext(function($ctx1) {
  1929. var $1;
  1930. $1=self._new_(aNumber);
  1931. return $1;
  1932. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  1933. args: ["aNumber"],
  1934. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  1935. messageSends: ["new:"],
  1936. referencedClasses: []
  1937. }),
  1938. smalltalk.Date.klass);
  1939. smalltalk.addMethod(
  1940. smalltalk.method({
  1941. selector: "fromSeconds:",
  1942. category: 'instance creation',
  1943. fn: function (aNumber){
  1944. var self=this;
  1945. return smalltalk.withContext(function($ctx1) {
  1946. var $1;
  1947. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  1948. return $1;
  1949. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  1950. args: ["aNumber"],
  1951. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  1952. messageSends: ["fromMilliseconds:", "*"],
  1953. referencedClasses: []
  1954. }),
  1955. smalltalk.Date.klass);
  1956. smalltalk.addMethod(
  1957. smalltalk.method({
  1958. selector: "fromString:",
  1959. category: 'instance creation',
  1960. fn: function (aString){
  1961. var self=this;
  1962. return smalltalk.withContext(function($ctx1) {
  1963. var $1;
  1964. $1=self._new_(aString);
  1965. return $1;
  1966. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})},
  1967. args: ["aString"],
  1968. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  1969. messageSends: ["new:"],
  1970. referencedClasses: []
  1971. }),
  1972. smalltalk.Date.klass);
  1973. smalltalk.addMethod(
  1974. smalltalk.method({
  1975. selector: "heliosClass",
  1976. category: 'helios',
  1977. fn: function (){
  1978. var self=this;
  1979. return smalltalk.withContext(function($ctx1) {
  1980. return "magnitude";
  1981. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Date.klass)})},
  1982. args: [],
  1983. source: "heliosClass\x0a\x09^ 'magnitude'",
  1984. messageSends: [],
  1985. referencedClasses: []
  1986. }),
  1987. smalltalk.Date.klass);
  1988. smalltalk.addMethod(
  1989. smalltalk.method({
  1990. selector: "millisecondsToRun:",
  1991. category: 'instance creation',
  1992. fn: function (aBlock){
  1993. var self=this;
  1994. var t;
  1995. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  1996. return smalltalk.withContext(function($ctx1) {
  1997. var $1;
  1998. t=_st($Date())._now();
  1999. _st(aBlock)._value();
  2000. $1=_st(_st($Date())._now()).__minus(t);
  2001. return $1;
  2002. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})},
  2003. args: ["aBlock"],
  2004. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2005. messageSends: ["now", "value", "-"],
  2006. referencedClasses: ["Date"]
  2007. }),
  2008. smalltalk.Date.klass);
  2009. smalltalk.addMethod(
  2010. smalltalk.method({
  2011. selector: "new:",
  2012. category: 'instance creation',
  2013. fn: function (anObject){
  2014. var self=this;
  2015. return smalltalk.withContext(function($ctx1) {
  2016. return new Date(anObject);
  2017. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})},
  2018. args: ["anObject"],
  2019. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2020. messageSends: [],
  2021. referencedClasses: []
  2022. }),
  2023. smalltalk.Date.klass);
  2024. smalltalk.addMethod(
  2025. smalltalk.method({
  2026. selector: "now",
  2027. category: 'instance creation',
  2028. fn: function (){
  2029. var self=this;
  2030. return smalltalk.withContext(function($ctx1) {
  2031. var $1;
  2032. $1=self._today();
  2033. return $1;
  2034. }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})},
  2035. args: [],
  2036. source: "now\x0a\x09^self today",
  2037. messageSends: ["today"],
  2038. referencedClasses: []
  2039. }),
  2040. smalltalk.Date.klass);
  2041. smalltalk.addMethod(
  2042. smalltalk.method({
  2043. selector: "today",
  2044. category: 'instance creation',
  2045. fn: function (){
  2046. var self=this;
  2047. return smalltalk.withContext(function($ctx1) {
  2048. var $1;
  2049. $1=self._new();
  2050. return $1;
  2051. }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})},
  2052. args: [],
  2053. source: "today\x0a\x09^self new",
  2054. messageSends: ["new"],
  2055. referencedClasses: []
  2056. }),
  2057. smalltalk.Date.klass);
  2058. smalltalk.addClass('Environment', smalltalk.Object, [], 'Kernel-Objects');
  2059. smalltalk.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
  2060. smalltalk.addMethod(
  2061. smalltalk.method({
  2062. selector: "addInstVarNamed:to:",
  2063. category: 'compiling',
  2064. fn: function (aString,aClass){
  2065. var self=this;
  2066. return smalltalk.withContext(function($ctx1) {
  2067. var $1,$2;
  2068. $1=_st(_st(aClass)._instanceVariableNames())._copy();
  2069. _st($1)._add_(aString);
  2070. $2=_st($1)._yourself();
  2071. _st(self._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
  2072. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  2073. args: ["aString", "aClass"],
  2074. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  2075. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"],
  2076. referencedClasses: []
  2077. }),
  2078. smalltalk.Environment);
  2079. smalltalk.addMethod(
  2080. smalltalk.method({
  2081. selector: "allSelectors",
  2082. category: 'accessing',
  2083. fn: function (){
  2084. var self=this;
  2085. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2086. return smalltalk.withContext(function($ctx1) {
  2087. var $1;
  2088. $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
  2089. return $1;
  2090. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
  2091. args: [],
  2092. source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
  2093. messageSends: ["value", "at:", "current"],
  2094. referencedClasses: ["Smalltalk"]
  2095. }),
  2096. smalltalk.Environment);
  2097. smalltalk.addMethod(
  2098. smalltalk.method({
  2099. selector: "availableClassNames",
  2100. category: 'accessing',
  2101. fn: function (){
  2102. var self=this;
  2103. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2104. return smalltalk.withContext(function($ctx1) {
  2105. var $1;
  2106. $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  2107. return smalltalk.withContext(function($ctx2) {
  2108. return _st(each)._name();
  2109. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2110. return $1;
  2111. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
  2112. args: [],
  2113. source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
  2114. messageSends: ["collect:", "name", "classes", "current"],
  2115. referencedClasses: ["Smalltalk"]
  2116. }),
  2117. smalltalk.Environment);
  2118. smalltalk.addMethod(
  2119. smalltalk.method({
  2120. selector: "availablePackageNames",
  2121. category: 'accessing',
  2122. fn: function (){
  2123. var self=this;
  2124. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2125. return smalltalk.withContext(function($ctx1) {
  2126. var $1;
  2127. $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
  2128. return smalltalk.withContext(function($ctx2) {
  2129. return _st(each)._name();
  2130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2131. return $1;
  2132. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
  2133. args: [],
  2134. source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
  2135. messageSends: ["collect:", "name", "packages", "current"],
  2136. referencedClasses: ["Smalltalk"]
  2137. }),
  2138. smalltalk.Environment);
  2139. smalltalk.addMethod(
  2140. smalltalk.method({
  2141. selector: "availableProtocolsFor:",
  2142. category: 'accessing',
  2143. fn: function (aClass){
  2144. var self=this;
  2145. var protocols;
  2146. return smalltalk.withContext(function($ctx1) {
  2147. var $1,$2;
  2148. protocols=_st(aClass)._protocols();
  2149. $1=_st(aClass)._superclass();
  2150. if(($receiver = $1) == nil || $receiver == undefined){
  2151. $1;
  2152. } else {
  2153. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  2154. };
  2155. $2=_st(_st(protocols)._asSet())._asArray();
  2156. return $2;
  2157. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
  2158. args: ["aClass"],
  2159. source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray",
  2160. messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"],
  2161. referencedClasses: []
  2162. }),
  2163. smalltalk.Environment);
  2164. smalltalk.addMethod(
  2165. smalltalk.method({
  2166. selector: "classBuilder",
  2167. category: 'accessing',
  2168. fn: function (){
  2169. var self=this;
  2170. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2171. return smalltalk.withContext(function($ctx1) {
  2172. var $1;
  2173. $1=_st($ClassBuilder())._new();
  2174. return $1;
  2175. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.Environment)})},
  2176. args: [],
  2177. source: "classBuilder\x0a\x09^ ClassBuilder new",
  2178. messageSends: ["new"],
  2179. referencedClasses: ["ClassBuilder"]
  2180. }),
  2181. smalltalk.Environment);
  2182. smalltalk.addMethod(
  2183. smalltalk.method({
  2184. selector: "classNamed:",
  2185. category: 'accessing',
  2186. fn: function (aString){
  2187. var self=this;
  2188. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2189. return smalltalk.withContext(function($ctx1) {
  2190. var $2,$1;
  2191. $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
  2192. if(($receiver = $2) == nil || $receiver == undefined){
  2193. $1=self._error_("Invalid class name");
  2194. } else {
  2195. $1=$2;
  2196. };
  2197. return $1;
  2198. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
  2199. args: ["aString"],
  2200. source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  2201. messageSends: ["ifNil:", "error:", "at:", "asSymbol", "current"],
  2202. referencedClasses: ["Smalltalk"]
  2203. }),
  2204. smalltalk.Environment);
  2205. smalltalk.addMethod(
  2206. smalltalk.method({
  2207. selector: "classes",
  2208. category: 'accessing',
  2209. fn: function (){
  2210. var self=this;
  2211. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2212. return smalltalk.withContext(function($ctx1) {
  2213. var $1;
  2214. $1=_st(_st($Smalltalk())._current())._classes();
  2215. return $1;
  2216. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
  2217. args: [],
  2218. source: "classes\x0a\x09^ Smalltalk current classes",
  2219. messageSends: ["classes", "current"],
  2220. referencedClasses: ["Smalltalk"]
  2221. }),
  2222. smalltalk.Environment);
  2223. smalltalk.addMethod(
  2224. smalltalk.method({
  2225. selector: "commitPackage:",
  2226. category: 'actions',
  2227. fn: function (aPackage){
  2228. var self=this;
  2229. return smalltalk.withContext(function($ctx1) {
  2230. _st(aPackage)._commit();
  2231. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.Environment)})},
  2232. args: ["aPackage"],
  2233. source: "commitPackage: aPackage\x0a\x09aPackage commit",
  2234. messageSends: ["commit"],
  2235. referencedClasses: []
  2236. }),
  2237. smalltalk.Environment);
  2238. smalltalk.addMethod(
  2239. smalltalk.method({
  2240. selector: "compileClassComment:for:",
  2241. category: 'compiling',
  2242. fn: function (aString,aClass){
  2243. var self=this;
  2244. return smalltalk.withContext(function($ctx1) {
  2245. _st(aClass)._comment_(aString);
  2246. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  2247. args: ["aString", "aClass"],
  2248. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  2249. messageSends: ["comment:"],
  2250. referencedClasses: []
  2251. }),
  2252. smalltalk.Environment);
  2253. smalltalk.addMethod(
  2254. smalltalk.method({
  2255. selector: "compileClassDefinition:",
  2256. category: 'compiling',
  2257. fn: function (aString){
  2258. var self=this;
  2259. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  2260. return smalltalk.withContext(function($ctx1) {
  2261. self._eval_on_(aString,_st($DoIt())._new());
  2262. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.Environment)})},
  2263. args: ["aString"],
  2264. source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
  2265. messageSends: ["eval:on:", "new"],
  2266. referencedClasses: ["DoIt"]
  2267. }),
  2268. smalltalk.Environment);
  2269. smalltalk.addMethod(
  2270. smalltalk.method({
  2271. selector: "compileMethod:for:protocol:",
  2272. category: 'compiling',
  2273. fn: function (sourceCode,class_,protocol){
  2274. var self=this;
  2275. return smalltalk.withContext(function($ctx1) {
  2276. var $1;
  2277. $1=_st(class_)._compile_category_(sourceCode,protocol);
  2278. return $1;
  2279. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.Environment)})},
  2280. args: ["sourceCode", "class", "protocol"],
  2281. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
  2282. messageSends: ["compile:category:"],
  2283. referencedClasses: []
  2284. }),
  2285. smalltalk.Environment);
  2286. smalltalk.addMethod(
  2287. smalltalk.method({
  2288. selector: "copyClass:to:",
  2289. category: 'actions',
  2290. fn: function (aClass,aClassName){
  2291. var self=this;
  2292. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2293. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2294. return smalltalk.withContext(function($ctx1) {
  2295. var $1;
  2296. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  2297. if(($receiver = $1) == nil || $receiver == undefined){
  2298. $1;
  2299. } else {
  2300. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  2301. };
  2302. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  2303. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  2304. args: ["aClass", "aClassName"],
  2305. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName\x0a\x09\x09\x0a\x09",
  2306. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "copyClass:named:", "new"],
  2307. referencedClasses: ["Smalltalk", "ClassBuilder"]
  2308. }),
  2309. smalltalk.Environment);
  2310. smalltalk.addMethod(
  2311. smalltalk.method({
  2312. selector: "eval:on:",
  2313. category: 'actions',
  2314. fn: function (aString,aReceiver){
  2315. var self=this;
  2316. var compiler;
  2317. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  2318. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2319. return smalltalk.withContext(function($ctx1) {
  2320. var $1,$2;
  2321. var $early={};
  2322. try {
  2323. compiler=_st($Compiler())._new();
  2324. _st((function(){
  2325. return smalltalk.withContext(function($ctx2) {
  2326. return _st(compiler)._parseExpression_(aString);
  2327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  2328. return smalltalk.withContext(function($ctx2) {
  2329. $1=_st(window)._alert_(_st(ex)._messageText());
  2330. throw $early=[$1];
  2331. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  2332. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  2333. return $2;
  2334. }
  2335. catch(e) {if(e===$early)return e[0]; throw e}
  2336. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.Environment)})},
  2337. args: ["aString", "aReceiver"],
  2338. source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ window alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
  2339. messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"],
  2340. referencedClasses: ["Compiler", "Error"]
  2341. }),
  2342. smalltalk.Environment);
  2343. smalltalk.addMethod(
  2344. smalltalk.method({
  2345. selector: "evaluate:on:do:",
  2346. category: 'error handling',
  2347. fn: function (aBlock,anErrorClass,exceptionBlock){
  2348. var self=this;
  2349. return smalltalk.withContext(function($ctx1) {
  2350. var $1;
  2351. self._try_catch_(aBlock,(function(exception){
  2352. return smalltalk.withContext(function($ctx2) {
  2353. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  2354. if(smalltalk.assert($1)){
  2355. return _st(exceptionBlock)._value_(exception);
  2356. } else {
  2357. return _st(exception)._signal();
  2358. };
  2359. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  2360. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
  2361. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  2362. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09self try: aBlock catch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
  2363. messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:", "classNamed:", "name"],
  2364. referencedClasses: []
  2365. }),
  2366. smalltalk.Environment);
  2367. smalltalk.addMethod(
  2368. smalltalk.method({
  2369. selector: "inspect:",
  2370. category: 'actions',
  2371. fn: function (anObject){
  2372. var self=this;
  2373. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  2374. return smalltalk.withContext(function($ctx1) {
  2375. _st(_st($InspectorHandler())._inspector())._inspect_(anObject);
  2376. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Environment)})},
  2377. args: ["anObject"],
  2378. source: "inspect: anObject\x0a\x09InspectorHandler inspector inspect: anObject",
  2379. messageSends: ["inspect:", "inspector"],
  2380. referencedClasses: ["InspectorHandler"]
  2381. }),
  2382. smalltalk.Environment);
  2383. smalltalk.addMethod(
  2384. smalltalk.method({
  2385. selector: "moveClass:toPackage:",
  2386. category: 'actions',
  2387. fn: function (aClass,aPackageName){
  2388. var self=this;
  2389. var package_;
  2390. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  2391. return smalltalk.withContext(function($ctx1) {
  2392. var $1,$2,$3;
  2393. package_=_st($Package())._named_(aPackageName);
  2394. $1=package_;
  2395. if(($receiver = $1) == nil || $receiver == undefined){
  2396. self._error_("Invalid package name");
  2397. } else {
  2398. $1;
  2399. };
  2400. $2=_st(package_).__eq_eq(_st(aClass)._package());
  2401. if(smalltalk.assert($2)){
  2402. $3=self;
  2403. return $3;
  2404. };
  2405. _st(aClass)._package_(package_);
  2406. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.Environment)})},
  2407. args: ["aClass", "aPackageName"],
  2408. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package",
  2409. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  2410. referencedClasses: ["Package"]
  2411. }),
  2412. smalltalk.Environment);
  2413. smalltalk.addMethod(
  2414. smalltalk.method({
  2415. selector: "moveMethod:toClass:",
  2416. category: 'actions',
  2417. fn: function (aMethod,aClassName){
  2418. var self=this;
  2419. var destinationClass;
  2420. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2421. return smalltalk.withContext(function($ctx1) {
  2422. var $1,$2,$3;
  2423. destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
  2424. $1=destinationClass;
  2425. if(($receiver = $1) == nil || $receiver == undefined){
  2426. self._error_("Invalid class name");
  2427. } else {
  2428. $1;
  2429. };
  2430. $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass());
  2431. if(smalltalk.assert($2)){
  2432. $3=self;
  2433. return $3;
  2434. };
  2435. _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
  2436. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  2437. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
  2438. args: ["aMethod", "aClassName"],
  2439. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09category: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod\x0a\x09",
  2440. messageSends: ["at:", "asSymbol", "current", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
  2441. referencedClasses: ["Smalltalk"]
  2442. }),
  2443. smalltalk.Environment);
  2444. smalltalk.addMethod(
  2445. smalltalk.method({
  2446. selector: "moveMethod:toProtocol:",
  2447. category: 'actions',
  2448. fn: function (aMethod,aProtocol){
  2449. var self=this;
  2450. return smalltalk.withContext(function($ctx1) {
  2451. _st(aMethod)._category_(aProtocol);
  2452. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.Environment)})},
  2453. args: ["aMethod", "aProtocol"],
  2454. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
  2455. messageSends: ["category:"],
  2456. referencedClasses: []
  2457. }),
  2458. smalltalk.Environment);
  2459. smalltalk.addMethod(
  2460. smalltalk.method({
  2461. selector: "packages",
  2462. category: 'accessing',
  2463. fn: function (){
  2464. var self=this;
  2465. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2466. return smalltalk.withContext(function($ctx1) {
  2467. var $1;
  2468. $1=_st(_st($Smalltalk())._current())._packages();
  2469. return $1;
  2470. }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
  2471. args: [],
  2472. source: "packages\x0a\x09^ Smalltalk current packages",
  2473. messageSends: ["packages", "current"],
  2474. referencedClasses: ["Smalltalk"]
  2475. }),
  2476. smalltalk.Environment);
  2477. smalltalk.addMethod(
  2478. smalltalk.method({
  2479. selector: "registerErrorHandler:",
  2480. category: 'actions',
  2481. fn: function (anErrorHandler){
  2482. var self=this;
  2483. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  2484. return smalltalk.withContext(function($ctx1) {
  2485. _st($ErrorHandler())._setCurrent_(anErrorHandler);
  2486. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
  2487. args: ["anErrorHandler"],
  2488. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
  2489. messageSends: ["setCurrent:"],
  2490. referencedClasses: ["ErrorHandler"]
  2491. }),
  2492. smalltalk.Environment);
  2493. smalltalk.addMethod(
  2494. smalltalk.method({
  2495. selector: "registerInspector:",
  2496. category: 'actions',
  2497. fn: function (anInspector){
  2498. var self=this;
  2499. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  2500. return smalltalk.withContext(function($ctx1) {
  2501. _st($InspectorHandler())._register_(anInspector);
  2502. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
  2503. args: ["anInspector"],
  2504. source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
  2505. messageSends: ["register:"],
  2506. referencedClasses: ["InspectorHandler"]
  2507. }),
  2508. smalltalk.Environment);
  2509. smalltalk.addMethod(
  2510. smalltalk.method({
  2511. selector: "registerProgressHandler:",
  2512. category: 'actions',
  2513. fn: function (aProgressHandler){
  2514. var self=this;
  2515. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  2516. return smalltalk.withContext(function($ctx1) {
  2517. _st($ProgressHandler())._setCurrent_(aProgressHandler);
  2518. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},smalltalk.Environment)})},
  2519. args: ["aProgressHandler"],
  2520. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler setCurrent: aProgressHandler",
  2521. messageSends: ["setCurrent:"],
  2522. referencedClasses: ["ProgressHandler"]
  2523. }),
  2524. smalltalk.Environment);
  2525. smalltalk.addMethod(
  2526. smalltalk.method({
  2527. selector: "removeClass:",
  2528. category: 'actions',
  2529. fn: function (aClass){
  2530. var self=this;
  2531. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2532. return smalltalk.withContext(function($ctx1) {
  2533. _st(_st($Smalltalk())._current())._removeClass_(aClass);
  2534. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
  2535. args: ["aClass"],
  2536. source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
  2537. messageSends: ["removeClass:", "current"],
  2538. referencedClasses: ["Smalltalk"]
  2539. }),
  2540. smalltalk.Environment);
  2541. smalltalk.addMethod(
  2542. smalltalk.method({
  2543. selector: "removeMethod:",
  2544. category: 'actions',
  2545. fn: function (aMethod){
  2546. var self=this;
  2547. return smalltalk.withContext(function($ctx1) {
  2548. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  2549. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})},
  2550. args: ["aMethod"],
  2551. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  2552. messageSends: ["removeCompiledMethod:", "methodClass"],
  2553. referencedClasses: []
  2554. }),
  2555. smalltalk.Environment);
  2556. smalltalk.addMethod(
  2557. smalltalk.method({
  2558. selector: "removeProtocol:from:",
  2559. category: 'actions',
  2560. fn: function (aString,aClass){
  2561. var self=this;
  2562. return smalltalk.withContext(function($ctx1) {
  2563. _st(_st(_st(aClass)._methods())._select_((function(each){
  2564. return smalltalk.withContext(function($ctx2) {
  2565. return _st(_st(each)._protocol()).__eq(aString);
  2566. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  2567. return smalltalk.withContext(function($ctx2) {
  2568. return _st(aClass)._removeCompiledMethod_(each);
  2569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2570. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  2571. args: ["aString", "aClass"],
  2572. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  2573. messageSends: ["do:", "removeCompiledMethod:", "select:", "=", "protocol", "methods"],
  2574. referencedClasses: []
  2575. }),
  2576. smalltalk.Environment);
  2577. smalltalk.addMethod(
  2578. smalltalk.method({
  2579. selector: "renameClass:to:",
  2580. category: 'actions',
  2581. fn: function (aClass,aClassName){
  2582. var self=this;
  2583. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2584. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2585. return smalltalk.withContext(function($ctx1) {
  2586. var $1;
  2587. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  2588. if(($receiver = $1) == nil || $receiver == undefined){
  2589. $1;
  2590. } else {
  2591. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  2592. };
  2593. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  2594. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  2595. args: ["aClass", "aClassName"],
  2596. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName\x09\x0a\x09",
  2597. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "renameClass:to:", "new"],
  2598. referencedClasses: ["Smalltalk", "ClassBuilder"]
  2599. }),
  2600. smalltalk.Environment);
  2601. smalltalk.addMethod(
  2602. smalltalk.method({
  2603. selector: "renameProtocol:to:in:",
  2604. category: 'actions',
  2605. fn: function (aString,anotherString,aClass){
  2606. var self=this;
  2607. return smalltalk.withContext(function($ctx1) {
  2608. _st(_st(_st(aClass)._methods())._select_((function(each){
  2609. return smalltalk.withContext(function($ctx2) {
  2610. return _st(_st(each)._protocol()).__eq(aString);
  2611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  2612. return smalltalk.withContext(function($ctx2) {
  2613. return _st(each)._protocol_(anotherString);
  2614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2615. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})},
  2616. args: ["aString", "anotherString", "aClass"],
  2617. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  2618. messageSends: ["do:", "protocol:", "select:", "=", "protocol", "methods"],
  2619. referencedClasses: []
  2620. }),
  2621. smalltalk.Environment);
  2622. smalltalk.addMethod(
  2623. smalltalk.method({
  2624. selector: "setClassCommentOf:to:",
  2625. category: 'actions',
  2626. fn: function (aClass,aString){
  2627. var self=this;
  2628. return smalltalk.withContext(function($ctx1) {
  2629. _st(aClass)._comment_(aString);
  2630. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
  2631. args: ["aClass", "aString"],
  2632. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  2633. messageSends: ["comment:"],
  2634. referencedClasses: []
  2635. }),
  2636. smalltalk.Environment);
  2637. smalltalk.addMethod(
  2638. smalltalk.method({
  2639. selector: "systemAnnouncer",
  2640. category: 'accessing',
  2641. fn: function (){
  2642. var self=this;
  2643. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2644. return smalltalk.withContext(function($ctx1) {
  2645. var $1;
  2646. $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
  2647. return $1;
  2648. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
  2649. args: [],
  2650. source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
  2651. messageSends: ["current", "at:"],
  2652. referencedClasses: ["Smalltalk"]
  2653. }),
  2654. smalltalk.Environment);
  2655. smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Objects');
  2656. smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript.";
  2657. smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
  2658. smalltalk.addMethod(
  2659. smalltalk.method({
  2660. selector: "inspect:",
  2661. category: 'registration',
  2662. fn: function (anObject){
  2663. var self=this;
  2664. return smalltalk.withContext(function($ctx1) {
  2665. var $1;
  2666. $1=_st(self._inspector())._inspect_(anObject);
  2667. return $1;
  2668. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
  2669. args: ["anObject"],
  2670. source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
  2671. messageSends: ["inspect:", "inspector"],
  2672. referencedClasses: []
  2673. }),
  2674. smalltalk.InspectorHandler.klass);
  2675. smalltalk.addMethod(
  2676. smalltalk.method({
  2677. selector: "inspector",
  2678. category: 'accessing',
  2679. fn: function (){
  2680. var self=this;
  2681. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2682. return smalltalk.withContext(function($ctx1) {
  2683. var $2,$1;
  2684. $2=self["@inspector"];
  2685. if(($receiver = $2) == nil || $receiver == undefined){
  2686. self["@inspector"]=$Transcript();
  2687. $1=self["@inspector"];
  2688. } else {
  2689. $1=$2;
  2690. };
  2691. return $1;
  2692. }, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
  2693. args: [],
  2694. source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
  2695. messageSends: ["ifNil:"],
  2696. referencedClasses: ["Transcript"]
  2697. }),
  2698. smalltalk.InspectorHandler.klass);
  2699. smalltalk.addMethod(
  2700. smalltalk.method({
  2701. selector: "register:",
  2702. category: 'registration',
  2703. fn: function (anInspector){
  2704. var self=this;
  2705. return smalltalk.withContext(function($ctx1) {
  2706. self["@inspector"]=anInspector;
  2707. return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
  2708. args: ["anInspector"],
  2709. source: "register: anInspector\x0a\x09inspector := anInspector",
  2710. messageSends: [],
  2711. referencedClasses: []
  2712. }),
  2713. smalltalk.InspectorHandler.klass);
  2714. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  2715. smalltalk.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  2716. smalltalk.addMethod(
  2717. smalltalk.method({
  2718. selector: "addObjectVariablesTo:",
  2719. category: 'proxy',
  2720. fn: function (aDictionary){
  2721. var self=this;
  2722. return smalltalk.withContext(function($ctx1) {
  2723. for(var i in self['@jsObject']) {
  2724. aDictionary._at_put_(i, self['@jsObject'][i]);
  2725. }
  2726. ;
  2727. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
  2728. args: ["aDictionary"],
  2729. source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>",
  2730. messageSends: [],
  2731. referencedClasses: []
  2732. }),
  2733. smalltalk.JSObjectProxy);
  2734. smalltalk.addMethod(
  2735. smalltalk.method({
  2736. selector: "at:",
  2737. category: 'accessing',
  2738. fn: function (aString){
  2739. var self=this;
  2740. return smalltalk.withContext(function($ctx1) {
  2741. return self['@jsObject'][aString];
  2742. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
  2743. args: ["aString"],
  2744. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  2745. messageSends: [],
  2746. referencedClasses: []
  2747. }),
  2748. smalltalk.JSObjectProxy);
  2749. smalltalk.addMethod(
  2750. smalltalk.method({
  2751. selector: "at:ifAbsent:",
  2752. category: 'accessing',
  2753. fn: function (aString,aBlock){
  2754. var self=this;
  2755. return smalltalk.withContext(function($ctx1) {
  2756. var obj = self['@jsObject'];
  2757. return aString in obj ? obj[aString] : aBlock();
  2758. ;
  2759. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  2760. args: ["aString", "aBlock"],
  2761. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock();\x0a\x09>",
  2762. messageSends: [],
  2763. referencedClasses: []
  2764. }),
  2765. smalltalk.JSObjectProxy);
  2766. smalltalk.addMethod(
  2767. smalltalk.method({
  2768. selector: "at:ifPresent:",
  2769. category: 'accessing',
  2770. fn: function (aString,aBlock){
  2771. var self=this;
  2772. return smalltalk.withContext(function($ctx1) {
  2773. var obj = self['@jsObject'];
  2774. return aString in obj ? aBlock(obj[aString]) : nil;
  2775. ;
  2776. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  2777. args: ["aString", "aBlock"],
  2778. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock(obj[aString]) : nil;\x0a\x09>",
  2779. messageSends: [],
  2780. referencedClasses: []
  2781. }),
  2782. smalltalk.JSObjectProxy);
  2783. smalltalk.addMethod(
  2784. smalltalk.method({
  2785. selector: "at:ifPresent:ifAbsent:",
  2786. category: 'accessing',
  2787. fn: function (aString,aBlock,anotherBlock){
  2788. var self=this;
  2789. return smalltalk.withContext(function($ctx1) {
  2790. var obj = self['@jsObject'];
  2791. return aString in obj ? aBlock(obj[aString]) : anotherBlock();
  2792. ;
  2793. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})},
  2794. args: ["aString", "aBlock", "anotherBlock"],
  2795. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock(obj[aString]) : anotherBlock();\x0a\x09>",
  2796. messageSends: [],
  2797. referencedClasses: []
  2798. }),
  2799. smalltalk.JSObjectProxy);
  2800. smalltalk.addMethod(
  2801. smalltalk.method({
  2802. selector: "at:put:",
  2803. category: 'accessing',
  2804. fn: function (aString,anObject){
  2805. var self=this;
  2806. return smalltalk.withContext(function($ctx1) {
  2807. self['@jsObject'][aString] = anObject;
  2808. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
  2809. args: ["aString", "anObject"],
  2810. source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
  2811. messageSends: [],
  2812. referencedClasses: []
  2813. }),
  2814. smalltalk.JSObjectProxy);
  2815. smalltalk.addMethod(
  2816. smalltalk.method({
  2817. selector: "doesNotUnderstand:",
  2818. category: 'proxy',
  2819. fn: function (aMessage){
  2820. var self=this;
  2821. return smalltalk.withContext(function($ctx1) {
  2822. var $2,$1;
  2823. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  2824. if(($receiver = $2) == nil || $receiver == undefined){
  2825. $1=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  2826. } else {
  2827. var jsSelector;
  2828. jsSelector=$receiver;
  2829. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  2830. };
  2831. return $1;
  2832. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
  2833. args: ["aMessage"],
  2834. source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]",
  2835. messageSends: ["ifNil:ifNotNil:", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments", "lookupProperty:", "asJavaScriptSelector", "selector"],
  2836. referencedClasses: []
  2837. }),
  2838. smalltalk.JSObjectProxy);
  2839. smalltalk.addMethod(
  2840. smalltalk.method({
  2841. selector: "forwardMessage:withArguments:",
  2842. category: 'proxy',
  2843. fn: function (aString,anArray){
  2844. var self=this;
  2845. return smalltalk.withContext(function($ctx1) {
  2846. return smalltalk.send(self._jsObject(), aString, anArray);
  2847. ;
  2848. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
  2849. args: ["aString", "anArray"],
  2850. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  2851. messageSends: [],
  2852. referencedClasses: []
  2853. }),
  2854. smalltalk.JSObjectProxy);
  2855. smalltalk.addMethod(
  2856. smalltalk.method({
  2857. selector: "inspectOn:",
  2858. category: 'proxy',
  2859. fn: function (anInspector){
  2860. var self=this;
  2861. var variables;
  2862. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2863. return smalltalk.withContext(function($ctx1) {
  2864. variables=_st($Dictionary())._new();
  2865. _st(variables)._at_put_("#self",self._jsObject());
  2866. _st(anInspector)._setLabel_(self._printString());
  2867. self._addObjectVariablesTo_(variables);
  2868. _st(anInspector)._setVariables_(variables);
  2869. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
  2870. args: ["anInspector"],
  2871. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables",
  2872. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  2873. referencedClasses: ["Dictionary"]
  2874. }),
  2875. smalltalk.JSObjectProxy);
  2876. smalltalk.addMethod(
  2877. smalltalk.method({
  2878. selector: "jsObject",
  2879. category: 'accessing',
  2880. fn: function (){
  2881. var self=this;
  2882. return smalltalk.withContext(function($ctx1) {
  2883. var $1;
  2884. $1=self["@jsObject"];
  2885. return $1;
  2886. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
  2887. args: [],
  2888. source: "jsObject\x0a\x09^jsObject",
  2889. messageSends: [],
  2890. referencedClasses: []
  2891. }),
  2892. smalltalk.JSObjectProxy);
  2893. smalltalk.addMethod(
  2894. smalltalk.method({
  2895. selector: "jsObject:",
  2896. category: 'accessing',
  2897. fn: function (aJSObject){
  2898. var self=this;
  2899. return smalltalk.withContext(function($ctx1) {
  2900. self["@jsObject"]=aJSObject;
  2901. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
  2902. args: ["aJSObject"],
  2903. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  2904. messageSends: [],
  2905. referencedClasses: []
  2906. }),
  2907. smalltalk.JSObjectProxy);
  2908. smalltalk.addMethod(
  2909. smalltalk.method({
  2910. selector: "keysAndValuesDo:",
  2911. category: 'enumerating',
  2912. fn: function (aBlock){
  2913. var self=this;
  2914. return smalltalk.withContext(function($ctx1) {
  2915. var o = self['@jsObject'];
  2916. for(var i in o) {
  2917. aBlock(i, o[i]);
  2918. }
  2919. ;
  2920. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})},
  2921. args: ["aBlock"],
  2922. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  2923. messageSends: [],
  2924. referencedClasses: []
  2925. }),
  2926. smalltalk.JSObjectProxy);
  2927. smalltalk.addMethod(
  2928. smalltalk.method({
  2929. selector: "lookupProperty:",
  2930. category: 'accessing',
  2931. fn: function (aString){
  2932. var self=this;
  2933. return smalltalk.withContext(function($ctx1) {
  2934. return aString in self._jsObject() ? aString : nil;
  2935. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
  2936. args: ["aString"],
  2937. source: "lookupProperty: aString\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<return aString in self._jsObject() ? aString : nil>",
  2938. messageSends: [],
  2939. referencedClasses: []
  2940. }),
  2941. smalltalk.JSObjectProxy);
  2942. smalltalk.addMethod(
  2943. smalltalk.method({
  2944. selector: "printOn:",
  2945. category: 'printing',
  2946. fn: function (aStream){
  2947. var self=this;
  2948. return smalltalk.withContext(function($ctx1) {
  2949. _st(aStream)._nextPutAll_(_st(self._jsObject())._toString());
  2950. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
  2951. args: ["aStream"],
  2952. source: "printOn: aStream\x0a\x09aStream nextPutAll: self jsObject toString",
  2953. messageSends: ["nextPutAll:", "toString", "jsObject"],
  2954. referencedClasses: []
  2955. }),
  2956. smalltalk.JSObjectProxy);
  2957. smalltalk.addMethod(
  2958. smalltalk.method({
  2959. selector: "value",
  2960. category: 'accessing',
  2961. fn: function (){
  2962. var self=this;
  2963. return smalltalk.withContext(function($ctx1) {
  2964. var $1;
  2965. $1=self._at_ifAbsent_("value",(function(){
  2966. return smalltalk.withContext(function($ctx2) {
  2967. return smalltalk.Object.fn.prototype._value.apply(_st(self), []);
  2968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2969. return $1;
  2970. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
  2971. args: [],
  2972. source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a\x09otherwise return the result of Object>>value.\x22\x0a\x09\x0a\x09^ self \x0a\x09\x09at: 'value' \x0a\x09\x09ifAbsent: [ super value ]",
  2973. messageSends: ["at:ifAbsent:", "value"],
  2974. referencedClasses: []
  2975. }),
  2976. smalltalk.JSObjectProxy);
  2977. smalltalk.addMethod(
  2978. smalltalk.method({
  2979. selector: "on:",
  2980. category: 'instance creation',
  2981. fn: function (aJSObject){
  2982. var self=this;
  2983. return smalltalk.withContext(function($ctx1) {
  2984. var $2,$3,$1;
  2985. $2=self._new();
  2986. _st($2)._jsObject_(aJSObject);
  2987. $3=_st($2)._yourself();
  2988. $1=$3;
  2989. return $1;
  2990. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
  2991. args: ["aJSObject"],
  2992. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  2993. messageSends: ["jsObject:", "new", "yourself"],
  2994. referencedClasses: []
  2995. }),
  2996. smalltalk.JSObjectProxy.klass);
  2997. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  2998. smalltalk.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].\x0a\x09\x0a\x091 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].\x0a\x09\x0a\x091 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr].";
  2999. smalltalk.addMethod(
  3000. smalltalk.method({
  3001. selector: "&",
  3002. category: 'converting',
  3003. fn: function (aNumber){
  3004. var self=this;
  3005. return smalltalk.withContext(function($ctx1) {
  3006. return self & aNumber;
  3007. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})},
  3008. args: ["aNumber"],
  3009. source: "& aNumber\x0a\x09<return self & aNumber>",
  3010. messageSends: [],
  3011. referencedClasses: []
  3012. }),
  3013. smalltalk.Number);
  3014. smalltalk.addMethod(
  3015. smalltalk.method({
  3016. selector: "*",
  3017. category: 'arithmetic',
  3018. fn: function (aNumber){
  3019. var self=this;
  3020. return smalltalk.withContext(function($ctx1) {
  3021. return self * aNumber;
  3022. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})},
  3023. args: ["aNumber"],
  3024. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3025. messageSends: [],
  3026. referencedClasses: []
  3027. }),
  3028. smalltalk.Number);
  3029. smalltalk.addMethod(
  3030. smalltalk.method({
  3031. selector: "+",
  3032. category: 'arithmetic',
  3033. fn: function (aNumber){
  3034. var self=this;
  3035. return smalltalk.withContext(function($ctx1) {
  3036. return self + aNumber;
  3037. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})},
  3038. args: ["aNumber"],
  3039. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3040. messageSends: [],
  3041. referencedClasses: []
  3042. }),
  3043. smalltalk.Number);
  3044. smalltalk.addMethod(
  3045. smalltalk.method({
  3046. selector: "-",
  3047. category: 'arithmetic',
  3048. fn: function (aNumber){
  3049. var self=this;
  3050. return smalltalk.withContext(function($ctx1) {
  3051. return self - aNumber;
  3052. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})},
  3053. args: ["aNumber"],
  3054. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3055. messageSends: [],
  3056. referencedClasses: []
  3057. }),
  3058. smalltalk.Number);
  3059. smalltalk.addMethod(
  3060. smalltalk.method({
  3061. selector: "/",
  3062. category: 'arithmetic',
  3063. fn: function (aNumber){
  3064. var self=this;
  3065. return smalltalk.withContext(function($ctx1) {
  3066. return self / aNumber;
  3067. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})},
  3068. args: ["aNumber"],
  3069. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3070. messageSends: [],
  3071. referencedClasses: []
  3072. }),
  3073. smalltalk.Number);
  3074. smalltalk.addMethod(
  3075. smalltalk.method({
  3076. selector: "<",
  3077. category: 'comparing',
  3078. fn: function (aNumber){
  3079. var self=this;
  3080. return smalltalk.withContext(function($ctx1) {
  3081. return self < aNumber;
  3082. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})},
  3083. args: ["aNumber"],
  3084. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3085. messageSends: [],
  3086. referencedClasses: []
  3087. }),
  3088. smalltalk.Number);
  3089. smalltalk.addMethod(
  3090. smalltalk.method({
  3091. selector: "<=",
  3092. category: 'comparing',
  3093. fn: function (aNumber){
  3094. var self=this;
  3095. return smalltalk.withContext(function($ctx1) {
  3096. return self <= aNumber;
  3097. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})},
  3098. args: ["aNumber"],
  3099. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3100. messageSends: [],
  3101. referencedClasses: []
  3102. }),
  3103. smalltalk.Number);
  3104. smalltalk.addMethod(
  3105. smalltalk.method({
  3106. selector: "=",
  3107. category: 'comparing',
  3108. fn: function (aNumber){
  3109. var self=this;
  3110. return smalltalk.withContext(function($ctx1) {
  3111. if(! aNumber._isNumber || ! aNumber._isNumber()) {
  3112. return false;
  3113. }
  3114. return Number(self) == aNumber
  3115. ;
  3116. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})},
  3117. args: ["aNumber"],
  3118. source: "= aNumber\x0a\x09<\x0a\x09\x09if(! aNumber._isNumber || ! aNumber._isNumber()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Number(self) == aNumber\x0a\x09>",
  3119. messageSends: [],
  3120. referencedClasses: []
  3121. }),
  3122. smalltalk.Number);
  3123. smalltalk.addMethod(
  3124. smalltalk.method({
  3125. selector: ">",
  3126. category: 'comparing',
  3127. fn: function (aNumber){
  3128. var self=this;
  3129. return smalltalk.withContext(function($ctx1) {
  3130. return self > aNumber;
  3131. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})},
  3132. args: ["aNumber"],
  3133. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3134. messageSends: [],
  3135. referencedClasses: []
  3136. }),
  3137. smalltalk.Number);
  3138. smalltalk.addMethod(
  3139. smalltalk.method({
  3140. selector: ">=",
  3141. category: 'comparing',
  3142. fn: function (aNumber){
  3143. var self=this;
  3144. return smalltalk.withContext(function($ctx1) {
  3145. return self >= aNumber;
  3146. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})},
  3147. args: ["aNumber"],
  3148. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3149. messageSends: [],
  3150. referencedClasses: []
  3151. }),
  3152. smalltalk.Number);
  3153. smalltalk.addMethod(
  3154. smalltalk.method({
  3155. selector: "@",
  3156. category: 'converting',
  3157. fn: function (aNumber){
  3158. var self=this;
  3159. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3160. return smalltalk.withContext(function($ctx1) {
  3161. var $1;
  3162. $1=_st($Point())._x_y_(self,aNumber);
  3163. return $1;
  3164. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})},
  3165. args: ["aNumber"],
  3166. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  3167. messageSends: ["x:y:"],
  3168. referencedClasses: ["Point"]
  3169. }),
  3170. smalltalk.Number);
  3171. smalltalk.addMethod(
  3172. smalltalk.method({
  3173. selector: "\x5c\x5c",
  3174. category: 'arithmetic',
  3175. fn: function (aNumber){
  3176. var self=this;
  3177. return smalltalk.withContext(function($ctx1) {
  3178. return self % aNumber;
  3179. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})},
  3180. args: ["aNumber"],
  3181. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3182. messageSends: [],
  3183. referencedClasses: []
  3184. }),
  3185. smalltalk.Number);
  3186. smalltalk.addMethod(
  3187. smalltalk.method({
  3188. selector: "abs",
  3189. category: 'arithmetic',
  3190. fn: function (){
  3191. var self=this;
  3192. return smalltalk.withContext(function($ctx1) {
  3193. return Math.abs(self);;
  3194. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})},
  3195. args: [],
  3196. source: "abs\x0a\x09<return Math.abs(self);>",
  3197. messageSends: [],
  3198. referencedClasses: []
  3199. }),
  3200. smalltalk.Number);
  3201. smalltalk.addMethod(
  3202. smalltalk.method({
  3203. selector: "asJSON",
  3204. category: 'converting',
  3205. fn: function (){
  3206. var self=this;
  3207. return smalltalk.withContext(function($ctx1) {
  3208. var $1;
  3209. $1=self;
  3210. return $1;
  3211. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})},
  3212. args: [],
  3213. source: "asJSON\x0a\x09^self",
  3214. messageSends: [],
  3215. referencedClasses: []
  3216. }),
  3217. smalltalk.Number);
  3218. smalltalk.addMethod(
  3219. smalltalk.method({
  3220. selector: "asJavascript",
  3221. category: 'converting',
  3222. fn: function (){
  3223. var self=this;
  3224. return smalltalk.withContext(function($ctx1) {
  3225. var $1;
  3226. $1=_st("(".__comma(self._printString())).__comma(")");
  3227. return $1;
  3228. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})},
  3229. args: [],
  3230. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  3231. messageSends: [",", "printString"],
  3232. referencedClasses: []
  3233. }),
  3234. smalltalk.Number);
  3235. smalltalk.addMethod(
  3236. smalltalk.method({
  3237. selector: "asPoint",
  3238. category: 'converting',
  3239. fn: function (){
  3240. var self=this;
  3241. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3242. return smalltalk.withContext(function($ctx1) {
  3243. var $1;
  3244. $1=_st($Point())._x_y_(self,self);
  3245. return $1;
  3246. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})},
  3247. args: [],
  3248. source: "asPoint\x0a\x09^Point x: self y: self",
  3249. messageSends: ["x:y:"],
  3250. referencedClasses: ["Point"]
  3251. }),
  3252. smalltalk.Number);
  3253. smalltalk.addMethod(
  3254. smalltalk.method({
  3255. selector: "asString",
  3256. category: 'converting',
  3257. fn: function (){
  3258. var self=this;
  3259. return smalltalk.withContext(function($ctx1) {
  3260. return String(self) ;
  3261. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})},
  3262. args: [],
  3263. source: "asString\x0a\x09< return String(self) >",
  3264. messageSends: [],
  3265. referencedClasses: []
  3266. }),
  3267. smalltalk.Number);
  3268. smalltalk.addMethod(
  3269. smalltalk.method({
  3270. selector: "atRandom",
  3271. category: 'converting',
  3272. fn: function (){
  3273. var self=this;
  3274. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  3275. return smalltalk.withContext(function($ctx1) {
  3276. var $1;
  3277. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3278. return $1;
  3279. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})},
  3280. args: [],
  3281. source: "atRandom\x0a\x09^(Random new next * self) truncated + 1",
  3282. messageSends: ["+", "truncated", "*", "next", "new"],
  3283. referencedClasses: ["Random"]
  3284. }),
  3285. smalltalk.Number);
  3286. smalltalk.addMethod(
  3287. smalltalk.method({
  3288. selector: "copy",
  3289. category: 'copying',
  3290. fn: function (){
  3291. var self=this;
  3292. return smalltalk.withContext(function($ctx1) {
  3293. var $1;
  3294. $1=self;
  3295. return $1;
  3296. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})},
  3297. args: [],
  3298. source: "copy\x0a\x09^self",
  3299. messageSends: [],
  3300. referencedClasses: []
  3301. }),
  3302. smalltalk.Number);
  3303. smalltalk.addMethod(
  3304. smalltalk.method({
  3305. selector: "deepCopy",
  3306. category: 'copying',
  3307. fn: function (){
  3308. var self=this;
  3309. return smalltalk.withContext(function($ctx1) {
  3310. var $1;
  3311. $1=self._copy();
  3312. return $1;
  3313. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})},
  3314. args: [],
  3315. source: "deepCopy\x0a\x09^self copy",
  3316. messageSends: ["copy"],
  3317. referencedClasses: []
  3318. }),
  3319. smalltalk.Number);
  3320. smalltalk.addMethod(
  3321. smalltalk.method({
  3322. selector: "even",
  3323. category: 'testing',
  3324. fn: function (){
  3325. var self=this;
  3326. return smalltalk.withContext(function($ctx1) {
  3327. var $1;
  3328. $1=(0).__eq(self.__backslash_backslash((2)));
  3329. return $1;
  3330. }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})},
  3331. args: [],
  3332. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3333. messageSends: ["=", "\x5c\x5c"],
  3334. referencedClasses: []
  3335. }),
  3336. smalltalk.Number);
  3337. smalltalk.addMethod(
  3338. smalltalk.method({
  3339. selector: "identityHash",
  3340. category: 'accessing',
  3341. fn: function (){
  3342. var self=this;
  3343. return smalltalk.withContext(function($ctx1) {
  3344. var $1;
  3345. $1=_st(self._asString()).__comma("n");
  3346. return $1;
  3347. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})},
  3348. args: [],
  3349. source: "identityHash\x0a\x09^self asString, 'n'",
  3350. messageSends: [",", "asString"],
  3351. referencedClasses: []
  3352. }),
  3353. smalltalk.Number);
  3354. smalltalk.addMethod(
  3355. smalltalk.method({
  3356. selector: "isImmutable",
  3357. category: 'testing',
  3358. fn: function (){
  3359. var self=this;
  3360. return smalltalk.withContext(function($ctx1) {
  3361. return true;
  3362. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Number)})},
  3363. args: [],
  3364. source: "isImmutable\x0a\x09^ true",
  3365. messageSends: [],
  3366. referencedClasses: []
  3367. }),
  3368. smalltalk.Number);
  3369. smalltalk.addMethod(
  3370. smalltalk.method({
  3371. selector: "isNumber",
  3372. category: 'testing',
  3373. fn: function (){
  3374. var self=this;
  3375. return smalltalk.withContext(function($ctx1) {
  3376. return true;
  3377. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})},
  3378. args: [],
  3379. source: "isNumber\x0a\x09^true",
  3380. messageSends: [],
  3381. referencedClasses: []
  3382. }),
  3383. smalltalk.Number);
  3384. smalltalk.addMethod(
  3385. smalltalk.method({
  3386. selector: "isZero",
  3387. category: 'testing',
  3388. fn: function (){
  3389. var self=this;
  3390. return smalltalk.withContext(function($ctx1) {
  3391. var $1;
  3392. $1=self.__eq((0));
  3393. return $1;
  3394. }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})},
  3395. args: [],
  3396. source: "isZero\x0a\x09^self = 0",
  3397. messageSends: ["="],
  3398. referencedClasses: []
  3399. }),
  3400. smalltalk.Number);
  3401. smalltalk.addMethod(
  3402. smalltalk.method({
  3403. selector: "max:",
  3404. category: 'arithmetic',
  3405. fn: function (aNumber){
  3406. var self=this;
  3407. return smalltalk.withContext(function($ctx1) {
  3408. return Math.max(self, aNumber);;
  3409. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})},
  3410. args: ["aNumber"],
  3411. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3412. messageSends: [],
  3413. referencedClasses: []
  3414. }),
  3415. smalltalk.Number);
  3416. smalltalk.addMethod(
  3417. smalltalk.method({
  3418. selector: "min:",
  3419. category: 'arithmetic',
  3420. fn: function (aNumber){
  3421. var self=this;
  3422. return smalltalk.withContext(function($ctx1) {
  3423. return Math.min(self, aNumber);;
  3424. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})},
  3425. args: ["aNumber"],
  3426. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3427. messageSends: [],
  3428. referencedClasses: []
  3429. }),
  3430. smalltalk.Number);
  3431. smalltalk.addMethod(
  3432. smalltalk.method({
  3433. selector: "negated",
  3434. category: 'arithmetic',
  3435. fn: function (){
  3436. var self=this;
  3437. return smalltalk.withContext(function($ctx1) {
  3438. var $1;
  3439. $1=(0).__minus(self);
  3440. return $1;
  3441. }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})},
  3442. args: [],
  3443. source: "negated\x0a\x09^0 - self",
  3444. messageSends: ["-"],
  3445. referencedClasses: []
  3446. }),
  3447. smalltalk.Number);
  3448. smalltalk.addMethod(
  3449. smalltalk.method({
  3450. selector: "negative",
  3451. category: 'testing',
  3452. fn: function (){
  3453. var self=this;
  3454. return smalltalk.withContext(function($ctx1) {
  3455. var $1;
  3456. $1=self.__lt((0));
  3457. return $1;
  3458. }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})},
  3459. args: [],
  3460. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3461. messageSends: ["<"],
  3462. referencedClasses: []
  3463. }),
  3464. smalltalk.Number);
  3465. smalltalk.addMethod(
  3466. smalltalk.method({
  3467. selector: "odd",
  3468. category: 'testing',
  3469. fn: function (){
  3470. var self=this;
  3471. return smalltalk.withContext(function($ctx1) {
  3472. var $1;
  3473. $1=_st(self._even())._not();
  3474. return $1;
  3475. }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})},
  3476. args: [],
  3477. source: "odd\x0a\x09^ self even not",
  3478. messageSends: ["not", "even"],
  3479. referencedClasses: []
  3480. }),
  3481. smalltalk.Number);
  3482. smalltalk.addMethod(
  3483. smalltalk.method({
  3484. selector: "positive",
  3485. category: 'testing',
  3486. fn: function (){
  3487. var self=this;
  3488. return smalltalk.withContext(function($ctx1) {
  3489. var $1;
  3490. $1=self.__gt_eq((0));
  3491. return $1;
  3492. }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.Number)})},
  3493. args: [],
  3494. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3495. messageSends: [">="],
  3496. referencedClasses: []
  3497. }),
  3498. smalltalk.Number);
  3499. smalltalk.addMethod(
  3500. smalltalk.method({
  3501. selector: "printOn:",
  3502. category: 'printing',
  3503. fn: function (aStream){
  3504. var self=this;
  3505. return smalltalk.withContext(function($ctx1) {
  3506. _st(aStream)._nextPutAll_(self._asString());
  3507. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})},
  3508. args: ["aStream"],
  3509. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3510. messageSends: ["nextPutAll:", "asString"],
  3511. referencedClasses: []
  3512. }),
  3513. smalltalk.Number);
  3514. smalltalk.addMethod(
  3515. smalltalk.method({
  3516. selector: "printShowingDecimalPlaces:",
  3517. category: 'printing',
  3518. fn: function (placesDesired){
  3519. var self=this;
  3520. return smalltalk.withContext(function($ctx1) {
  3521. return self.toFixed(placesDesired);
  3522. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})},
  3523. args: ["placesDesired"],
  3524. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  3525. messageSends: [],
  3526. referencedClasses: []
  3527. }),
  3528. smalltalk.Number);
  3529. smalltalk.addMethod(
  3530. smalltalk.method({
  3531. selector: "rounded",
  3532. category: 'converting',
  3533. fn: function (){
  3534. var self=this;
  3535. return smalltalk.withContext(function($ctx1) {
  3536. return Math.round(self);;
  3537. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})},
  3538. args: [],
  3539. source: "rounded\x0a\x09<return Math.round(self);>",
  3540. messageSends: [],
  3541. referencedClasses: []
  3542. }),
  3543. smalltalk.Number);
  3544. smalltalk.addMethod(
  3545. smalltalk.method({
  3546. selector: "sqrt",
  3547. category: 'arithmetic',
  3548. fn: function (){
  3549. var self=this;
  3550. return smalltalk.withContext(function($ctx1) {
  3551. return Math.sqrt(self);
  3552. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})},
  3553. args: [],
  3554. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  3555. messageSends: [],
  3556. referencedClasses: []
  3557. }),
  3558. smalltalk.Number);
  3559. smalltalk.addMethod(
  3560. smalltalk.method({
  3561. selector: "squared",
  3562. category: 'arithmetic',
  3563. fn: function (){
  3564. var self=this;
  3565. return smalltalk.withContext(function($ctx1) {
  3566. var $1;
  3567. $1=self.__star(self);
  3568. return $1;
  3569. }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})},
  3570. args: [],
  3571. source: "squared\x0a\x09^self * self",
  3572. messageSends: ["*"],
  3573. referencedClasses: []
  3574. }),
  3575. smalltalk.Number);
  3576. smalltalk.addMethod(
  3577. smalltalk.method({
  3578. selector: "timesRepeat:",
  3579. category: 'enumerating',
  3580. fn: function (aBlock){
  3581. var self=this;
  3582. var count;
  3583. return smalltalk.withContext(function($ctx1) {
  3584. count=(1);
  3585. _st((function(){
  3586. return smalltalk.withContext(function($ctx2) {
  3587. return _st(count).__gt(self);
  3588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  3589. return smalltalk.withContext(function($ctx2) {
  3590. _st(aBlock)._value();
  3591. count=_st(count).__plus((1));
  3592. return count;
  3593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3594. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.Number)})},
  3595. args: ["aBlock"],
  3596. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1]",
  3597. messageSends: ["whileFalse:", "value", "+", ">"],
  3598. referencedClasses: []
  3599. }),
  3600. smalltalk.Number);
  3601. smalltalk.addMethod(
  3602. smalltalk.method({
  3603. selector: "to:",
  3604. category: 'converting',
  3605. fn: function (aNumber){
  3606. var self=this;
  3607. var array,first,last,count;
  3608. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3609. return smalltalk.withContext(function($ctx1) {
  3610. var $1;
  3611. first=self._truncated();
  3612. last=_st(_st(aNumber)._truncated()).__plus((1));
  3613. count=(1);
  3614. array=_st($Array())._new();
  3615. _st(_st(last).__minus(first))._timesRepeat_((function(){
  3616. return smalltalk.withContext(function($ctx2) {
  3617. _st(array)._at_put_(count,first);
  3618. count=_st(count).__plus((1));
  3619. count;
  3620. first=_st(first).__plus((1));
  3621. return first;
  3622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3623. $1=array;
  3624. return $1;
  3625. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.Number)})},
  3626. args: ["aNumber"],
  3627. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1].\x0a\x09^array",
  3628. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  3629. referencedClasses: ["Array"]
  3630. }),
  3631. smalltalk.Number);
  3632. smalltalk.addMethod(
  3633. smalltalk.method({
  3634. selector: "to:by:",
  3635. category: 'converting',
  3636. fn: function (stop,step){
  3637. var self=this;
  3638. var array,value,pos;
  3639. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3640. return smalltalk.withContext(function($ctx1) {
  3641. var $1,$2,$3;
  3642. value=self;
  3643. array=_st($Array())._new();
  3644. pos=(1);
  3645. $1=_st(step).__eq((0));
  3646. if(smalltalk.assert($1)){
  3647. self._error_("step must be non-zero");
  3648. };
  3649. $2=_st(step).__lt((0));
  3650. if(smalltalk.assert($2)){
  3651. _st((function(){
  3652. return smalltalk.withContext(function($ctx2) {
  3653. return _st(value).__gt_eq(stop);
  3654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3655. return smalltalk.withContext(function($ctx2) {
  3656. _st(array)._at_put_(pos,value);
  3657. pos=_st(pos).__plus((1));
  3658. pos;
  3659. value=_st(value).__plus(step);
  3660. return value;
  3661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3662. } else {
  3663. _st((function(){
  3664. return smalltalk.withContext(function($ctx2) {
  3665. return _st(value).__lt_eq(stop);
  3666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3667. return smalltalk.withContext(function($ctx2) {
  3668. _st(array)._at_put_(pos,value);
  3669. pos=_st(pos).__plus((1));
  3670. pos;
  3671. value=_st(value).__plus(step);
  3672. return value;
  3673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3674. };
  3675. $3=array;
  3676. return $3;
  3677. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.Number)})},
  3678. args: ["stop", "step"],
  3679. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]].\x0a\x09^array",
  3680. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  3681. referencedClasses: ["Array"]
  3682. }),
  3683. smalltalk.Number);
  3684. smalltalk.addMethod(
  3685. smalltalk.method({
  3686. selector: "to:by:do:",
  3687. category: 'enumerating',
  3688. fn: function (stop,step,aBlock){
  3689. var self=this;
  3690. var value;
  3691. return smalltalk.withContext(function($ctx1) {
  3692. var $1,$2;
  3693. value=self;
  3694. $1=_st(step).__eq((0));
  3695. if(smalltalk.assert($1)){
  3696. self._error_("step must be non-zero");
  3697. };
  3698. $2=_st(step).__lt((0));
  3699. if(smalltalk.assert($2)){
  3700. _st((function(){
  3701. return smalltalk.withContext(function($ctx2) {
  3702. return _st(value).__gt_eq(stop);
  3703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3704. return smalltalk.withContext(function($ctx2) {
  3705. _st(aBlock)._value_(value);
  3706. value=_st(value).__plus(step);
  3707. return value;
  3708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3709. } else {
  3710. _st((function(){
  3711. return smalltalk.withContext(function($ctx2) {
  3712. return _st(value).__lt_eq(stop);
  3713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3714. return smalltalk.withContext(function($ctx2) {
  3715. _st(aBlock)._value_(value);
  3716. value=_st(value).__plus(step);
  3717. return value;
  3718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3719. };
  3720. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.Number)})},
  3721. args: ["stop", "step", "aBlock"],
  3722. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]",
  3723. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  3724. referencedClasses: []
  3725. }),
  3726. smalltalk.Number);
  3727. smalltalk.addMethod(
  3728. smalltalk.method({
  3729. selector: "to:do:",
  3730. category: 'enumerating',
  3731. fn: function (stop,aBlock){
  3732. var self=this;
  3733. var nextValue;
  3734. return smalltalk.withContext(function($ctx1) {
  3735. nextValue=self;
  3736. _st((function(){
  3737. return smalltalk.withContext(function($ctx2) {
  3738. return _st(nextValue).__lt_eq(stop);
  3739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3740. return smalltalk.withContext(function($ctx2) {
  3741. _st(aBlock)._value_(nextValue);
  3742. nextValue=_st(nextValue).__plus((1));
  3743. return nextValue;
  3744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3745. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.Number)})},
  3746. args: ["stop", "aBlock"],
  3747. 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]",
  3748. messageSends: ["whileTrue:", "value:", "+", "<="],
  3749. referencedClasses: []
  3750. }),
  3751. smalltalk.Number);
  3752. smalltalk.addMethod(
  3753. smalltalk.method({
  3754. selector: "truncated",
  3755. category: 'converting',
  3756. fn: function (){
  3757. var self=this;
  3758. return smalltalk.withContext(function($ctx1) {
  3759. if(self >= 0) {
  3760. return Math.floor(self);
  3761. } else {
  3762. return Math.floor(self * (-1)) * (-1);
  3763. };
  3764. ;
  3765. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},smalltalk.Number)})},
  3766. args: [],
  3767. source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>",
  3768. messageSends: [],
  3769. referencedClasses: []
  3770. }),
  3771. smalltalk.Number);
  3772. smalltalk.addMethod(
  3773. smalltalk.method({
  3774. selector: "|",
  3775. category: 'converting',
  3776. fn: function (aNumber){
  3777. var self=this;
  3778. return smalltalk.withContext(function($ctx1) {
  3779. return self | aNumber;
  3780. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})},
  3781. args: ["aNumber"],
  3782. source: "| aNumber\x0a\x09<return self | aNumber>",
  3783. messageSends: [],
  3784. referencedClasses: []
  3785. }),
  3786. smalltalk.Number);
  3787. smalltalk.addMethod(
  3788. smalltalk.method({
  3789. selector: "heliosClass",
  3790. category: 'helios',
  3791. fn: function (){
  3792. var self=this;
  3793. return smalltalk.withContext(function($ctx1) {
  3794. return "magnitude";
  3795. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Number.klass)})},
  3796. args: [],
  3797. source: "heliosClass\x0a\x09^ 'magnitude'",
  3798. messageSends: [],
  3799. referencedClasses: []
  3800. }),
  3801. smalltalk.Number.klass);
  3802. smalltalk.addMethod(
  3803. smalltalk.method({
  3804. selector: "pi",
  3805. category: 'instance creation',
  3806. fn: function (){
  3807. var self=this;
  3808. return smalltalk.withContext(function($ctx1) {
  3809. return Math.PI;
  3810. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})},
  3811. args: [],
  3812. source: "pi\x0a\x09<return Math.PI>",
  3813. messageSends: [],
  3814. referencedClasses: []
  3815. }),
  3816. smalltalk.Number.klass);
  3817. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  3818. smalltalk.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  3819. smalltalk.addMethod(
  3820. smalltalk.method({
  3821. selector: "addElement:",
  3822. category: 'accessing',
  3823. fn: function (anObject){
  3824. var self=this;
  3825. return smalltalk.withContext(function($ctx1) {
  3826. self.elements.addElement(anObject);
  3827. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
  3828. args: ["anObject"],
  3829. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  3830. messageSends: [],
  3831. referencedClasses: []
  3832. }),
  3833. smalltalk.Organizer);
  3834. smalltalk.addMethod(
  3835. smalltalk.method({
  3836. selector: "elements",
  3837. category: 'accessing',
  3838. fn: function (){
  3839. var self=this;
  3840. return smalltalk.withContext(function($ctx1) {
  3841. var $1;
  3842. $1=_st(self._basicAt_("elements"))._copy();
  3843. return $1;
  3844. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
  3845. args: [],
  3846. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  3847. messageSends: ["copy", "basicAt:"],
  3848. referencedClasses: []
  3849. }),
  3850. smalltalk.Organizer);
  3851. smalltalk.addMethod(
  3852. smalltalk.method({
  3853. selector: "removeElement:",
  3854. category: 'accessing',
  3855. fn: function (anObject){
  3856. var self=this;
  3857. return smalltalk.withContext(function($ctx1) {
  3858. self.elements.removeElement(anObject);
  3859. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
  3860. args: ["anObject"],
  3861. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  3862. messageSends: [],
  3863. referencedClasses: []
  3864. }),
  3865. smalltalk.Organizer);
  3866. smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  3867. smalltalk.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  3868. smalltalk.addMethod(
  3869. smalltalk.method({
  3870. selector: "addElement:",
  3871. category: 'accessing',
  3872. fn: function (aString){
  3873. var self=this;
  3874. function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  3875. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  3876. return smalltalk.withContext(function($ctx1) {
  3877. var $1,$2;
  3878. smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
  3879. $1=_st($ProtocolAdded())._new();
  3880. _st($1)._protocol_(aString);
  3881. _st($1)._theClass_(self._theClass());
  3882. $2=_st($1)._yourself();
  3883. _st(_st($SystemAnnouncer())._current())._announce_($2);
  3884. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  3885. args: ["aString"],
  3886. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  3887. messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  3888. referencedClasses: ["ProtocolAdded", "SystemAnnouncer"]
  3889. }),
  3890. smalltalk.ClassOrganizer);
  3891. smalltalk.addMethod(
  3892. smalltalk.method({
  3893. selector: "removeElement:",
  3894. category: 'accessing',
  3895. fn: function (aString){
  3896. var self=this;
  3897. function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  3898. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  3899. return smalltalk.withContext(function($ctx1) {
  3900. var $1,$2;
  3901. smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
  3902. $1=_st($ProtocolRemoved())._new();
  3903. _st($1)._protocol_(aString);
  3904. _st($1)._theClass_(self._theClass());
  3905. $2=_st($1)._yourself();
  3906. _st(_st($SystemAnnouncer())._current())._announce_($2);
  3907. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  3908. args: ["aString"],
  3909. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  3910. messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  3911. referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"]
  3912. }),
  3913. smalltalk.ClassOrganizer);
  3914. smalltalk.addMethod(
  3915. smalltalk.method({
  3916. selector: "theClass",
  3917. category: 'accessing',
  3918. fn: function (){
  3919. var self=this;
  3920. return smalltalk.withContext(function($ctx1) {
  3921. return self.theClass ;
  3922. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
  3923. args: [],
  3924. source: "theClass\x0a\x09< return self.theClass >",
  3925. messageSends: [],
  3926. referencedClasses: []
  3927. }),
  3928. smalltalk.ClassOrganizer);
  3929. smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  3930. smalltalk.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  3931. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  3932. smalltalk.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  3933. smalltalk.addMethod(
  3934. smalltalk.method({
  3935. selector: "classes",
  3936. category: 'classes',
  3937. fn: function (){
  3938. var self=this;
  3939. return smalltalk.withContext(function($ctx1) {
  3940. var $1;
  3941. $1=_st(self._organization())._elements();
  3942. return $1;
  3943. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
  3944. args: [],
  3945. source: "classes\x0a\x09^ self organization elements",
  3946. messageSends: ["elements", "organization"],
  3947. referencedClasses: []
  3948. }),
  3949. smalltalk.Package);
  3950. smalltalk.addMethod(
  3951. smalltalk.method({
  3952. selector: "commitPathJs",
  3953. category: 'accessing',
  3954. fn: function (){
  3955. var self=this;
  3956. return smalltalk.withContext(function($ctx1) {
  3957. var $2,$1;
  3958. $2=self["@commitPathJs"];
  3959. if(($receiver = $2) == nil || $receiver == undefined){
  3960. $1=_st(self._class())._defaultCommitPathJs();
  3961. } else {
  3962. $1=$2;
  3963. };
  3964. return $1;
  3965. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  3966. args: [],
  3967. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  3968. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  3969. referencedClasses: []
  3970. }),
  3971. smalltalk.Package);
  3972. smalltalk.addMethod(
  3973. smalltalk.method({
  3974. selector: "commitPathJs:",
  3975. category: 'accessing',
  3976. fn: function (aString){
  3977. var self=this;
  3978. return smalltalk.withContext(function($ctx1) {
  3979. self["@commitPathJs"]=aString;
  3980. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  3981. args: ["aString"],
  3982. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  3983. messageSends: [],
  3984. referencedClasses: []
  3985. }),
  3986. smalltalk.Package);
  3987. smalltalk.addMethod(
  3988. smalltalk.method({
  3989. selector: "commitPathSt",
  3990. category: 'accessing',
  3991. fn: function (){
  3992. var self=this;
  3993. return smalltalk.withContext(function($ctx1) {
  3994. var $2,$1;
  3995. $2=self["@commitPathSt"];
  3996. if(($receiver = $2) == nil || $receiver == undefined){
  3997. $1=_st(self._class())._defaultCommitPathSt();
  3998. } else {
  3999. $1=$2;
  4000. };
  4001. return $1;
  4002. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  4003. args: [],
  4004. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  4005. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  4006. referencedClasses: []
  4007. }),
  4008. smalltalk.Package);
  4009. smalltalk.addMethod(
  4010. smalltalk.method({
  4011. selector: "commitPathSt:",
  4012. category: 'accessing',
  4013. fn: function (aString){
  4014. var self=this;
  4015. return smalltalk.withContext(function($ctx1) {
  4016. self["@commitPathSt"]=aString;
  4017. return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  4018. args: ["aString"],
  4019. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  4020. messageSends: [],
  4021. referencedClasses: []
  4022. }),
  4023. smalltalk.Package);
  4024. smalltalk.addMethod(
  4025. smalltalk.method({
  4026. selector: "isPackage",
  4027. category: 'testing',
  4028. fn: function (){
  4029. var self=this;
  4030. return smalltalk.withContext(function($ctx1) {
  4031. return true;
  4032. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
  4033. args: [],
  4034. source: "isPackage\x0a\x09^ true",
  4035. messageSends: [],
  4036. referencedClasses: []
  4037. }),
  4038. smalltalk.Package);
  4039. smalltalk.addMethod(
  4040. smalltalk.method({
  4041. selector: "name",
  4042. category: 'accessing',
  4043. fn: function (){
  4044. var self=this;
  4045. return smalltalk.withContext(function($ctx1) {
  4046. return self.pkgName;
  4047. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
  4048. args: [],
  4049. source: "name\x0a\x09<return self.pkgName>",
  4050. messageSends: [],
  4051. referencedClasses: []
  4052. }),
  4053. smalltalk.Package);
  4054. smalltalk.addMethod(
  4055. smalltalk.method({
  4056. selector: "name:",
  4057. category: 'accessing',
  4058. fn: function (aString){
  4059. var self=this;
  4060. return smalltalk.withContext(function($ctx1) {
  4061. self.pkgName = aString;
  4062. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
  4063. args: ["aString"],
  4064. source: "name: aString\x0a\x09<self.pkgName = aString>",
  4065. messageSends: [],
  4066. referencedClasses: []
  4067. }),
  4068. smalltalk.Package);
  4069. smalltalk.addMethod(
  4070. smalltalk.method({
  4071. selector: "organization",
  4072. category: 'accessing',
  4073. fn: function (){
  4074. var self=this;
  4075. return smalltalk.withContext(function($ctx1) {
  4076. var $1;
  4077. $1=self._basicAt_("organization");
  4078. return $1;
  4079. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
  4080. args: [],
  4081. source: "organization\x0a\x09^ self basicAt: 'organization'",
  4082. messageSends: ["basicAt:"],
  4083. referencedClasses: []
  4084. }),
  4085. smalltalk.Package);
  4086. smalltalk.addMethod(
  4087. smalltalk.method({
  4088. selector: "printOn:",
  4089. category: 'printing',
  4090. fn: function (aStream){
  4091. var self=this;
  4092. return smalltalk.withContext(function($ctx1) {
  4093. var $1,$2;
  4094. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  4095. $1=aStream;
  4096. _st($1)._nextPutAll_(" (");
  4097. _st($1)._nextPutAll_(self._name());
  4098. $2=_st($1)._nextPutAll_(")");
  4099. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
  4100. args: ["aStream"],
  4101. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  4102. messageSends: ["printOn:", "nextPutAll:", "name"],
  4103. referencedClasses: []
  4104. }),
  4105. smalltalk.Package);
  4106. smalltalk.addMethod(
  4107. smalltalk.method({
  4108. selector: "setupClasses",
  4109. category: 'classes',
  4110. fn: function (){
  4111. var self=this;
  4112. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  4113. return smalltalk.withContext(function($ctx1) {
  4114. var $1,$2;
  4115. $1=self._classes();
  4116. _st($1)._do_((function(each){
  4117. return smalltalk.withContext(function($ctx2) {
  4118. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  4119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4120. $2=_st($1)._do_((function(each){
  4121. return smalltalk.withContext(function($ctx2) {
  4122. return _st(each)._initialize();
  4123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4124. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
  4125. args: [],
  4126. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  4127. messageSends: ["do:", "setupClass:", "new", "classes", "initialize"],
  4128. referencedClasses: ["ClassBuilder"]
  4129. }),
  4130. smalltalk.Package);
  4131. smalltalk.addMethod(
  4132. smalltalk.method({
  4133. selector: "sortedClasses",
  4134. category: 'classes',
  4135. fn: function (){
  4136. var self=this;
  4137. return smalltalk.withContext(function($ctx1) {
  4138. var $1;
  4139. $1=_st(self._class())._sortedClasses_(self._classes());
  4140. return $1;
  4141. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})},
  4142. args: [],
  4143. 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",
  4144. messageSends: ["sortedClasses:", "classes", "class"],
  4145. referencedClasses: []
  4146. }),
  4147. smalltalk.Package);
  4148. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  4149. smalltalk.addMethod(
  4150. smalltalk.method({
  4151. selector: "commitPathsFromLoader",
  4152. category: 'commit paths',
  4153. fn: function (){
  4154. var self=this;
  4155. return smalltalk.withContext(function($ctx1) {
  4156. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  4157. if (!commitPath) return;
  4158. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  4159. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  4160. ;
  4161. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.Package.klass)})},
  4162. args: [],
  4163. source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>",
  4164. messageSends: [],
  4165. referencedClasses: []
  4166. }),
  4167. smalltalk.Package.klass);
  4168. smalltalk.addMethod(
  4169. smalltalk.method({
  4170. selector: "defaultCommitPathJs",
  4171. category: 'commit paths',
  4172. fn: function (){
  4173. var self=this;
  4174. return smalltalk.withContext(function($ctx1) {
  4175. var $2,$1;
  4176. $2=self["@defaultCommitPathJs"];
  4177. if(($receiver = $2) == nil || $receiver == undefined){
  4178. self["@defaultCommitPathJs"]="js";
  4179. $1=self["@defaultCommitPathJs"];
  4180. } else {
  4181. $1=$2;
  4182. };
  4183. return $1;
  4184. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.Package.klass)})},
  4185. args: [],
  4186. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  4187. messageSends: ["ifNil:"],
  4188. referencedClasses: []
  4189. }),
  4190. smalltalk.Package.klass);
  4191. smalltalk.addMethod(
  4192. smalltalk.method({
  4193. selector: "defaultCommitPathJs:",
  4194. category: 'commit paths',
  4195. fn: function (aString){
  4196. var self=this;
  4197. return smalltalk.withContext(function($ctx1) {
  4198. self["@defaultCommitPathJs"]=aString;
  4199. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.Package.klass)})},
  4200. args: ["aString"],
  4201. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  4202. messageSends: [],
  4203. referencedClasses: []
  4204. }),
  4205. smalltalk.Package.klass);
  4206. smalltalk.addMethod(
  4207. smalltalk.method({
  4208. selector: "defaultCommitPathSt",
  4209. category: 'commit paths',
  4210. fn: function (){
  4211. var self=this;
  4212. return smalltalk.withContext(function($ctx1) {
  4213. var $2,$1;
  4214. $2=self["@defaultCommitPathSt"];
  4215. if(($receiver = $2) == nil || $receiver == undefined){
  4216. self["@defaultCommitPathSt"]="st";
  4217. $1=self["@defaultCommitPathSt"];
  4218. } else {
  4219. $1=$2;
  4220. };
  4221. return $1;
  4222. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.Package.klass)})},
  4223. args: [],
  4224. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  4225. messageSends: ["ifNil:"],
  4226. referencedClasses: []
  4227. }),
  4228. smalltalk.Package.klass);
  4229. smalltalk.addMethod(
  4230. smalltalk.method({
  4231. selector: "defaultCommitPathSt:",
  4232. category: 'commit paths',
  4233. fn: function (aString){
  4234. var self=this;
  4235. return smalltalk.withContext(function($ctx1) {
  4236. self["@defaultCommitPathSt"]=aString;
  4237. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.Package.klass)})},
  4238. args: ["aString"],
  4239. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  4240. messageSends: [],
  4241. referencedClasses: []
  4242. }),
  4243. smalltalk.Package.klass);
  4244. smalltalk.addMethod(
  4245. smalltalk.method({
  4246. selector: "initialize",
  4247. category: 'initialization',
  4248. fn: function (){
  4249. var self=this;
  4250. return smalltalk.withContext(function($ctx1) {
  4251. smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []);
  4252. self._commitPathsFromLoader();
  4253. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Package.klass)})},
  4254. args: [],
  4255. source: "initialize\x0a\x09super initialize.\x0a\x09self commitPathsFromLoader",
  4256. messageSends: ["initialize", "commitPathsFromLoader"],
  4257. referencedClasses: []
  4258. }),
  4259. smalltalk.Package.klass);
  4260. smalltalk.addMethod(
  4261. smalltalk.method({
  4262. selector: "load:",
  4263. category: 'loading-storing',
  4264. fn: function (aPackageName){
  4265. var self=this;
  4266. return smalltalk.withContext(function($ctx1) {
  4267. self._load_prefix_(aPackageName,_st(self._defaultCommitPathJs()).__comma("/"));
  4268. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  4269. args: ["aPackageName"],
  4270. source: "load: aPackageName\x0a\x09self load: aPackageName prefix: self defaultCommitPathJs, '/'",
  4271. messageSends: ["load:prefix:", ",", "defaultCommitPathJs"],
  4272. referencedClasses: []
  4273. }),
  4274. smalltalk.Package.klass);
  4275. smalltalk.addMethod(
  4276. smalltalk.method({
  4277. selector: "load:prefix:",
  4278. category: 'loading-storing',
  4279. fn: function (aPackageName,aPrefix){
  4280. var self=this;
  4281. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  4282. return smalltalk.withContext(function($ctx1) {
  4283. _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){
  4284. return smalltalk.withContext(function($ctx2) {
  4285. return _st(_st($Package())._named_(aPackageName))._setupClasses();
  4286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4287. return self}, function($ctx1) {$ctx1.fill(self,"load:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix},smalltalk.Package.klass)})},
  4288. args: ["aPackageName", "aPrefix"],
  4289. source: "load: aPackageName prefix: aPrefix\x0a\x09jQuery\x0a\x09\x09getScript: (aPrefix , aPackageName , '.js')\x0a\x09\x09onSuccess: [\x0a\x09\x09\x09(Package named: aPackageName) setupClasses ]",
  4290. messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"],
  4291. referencedClasses: ["Package"]
  4292. }),
  4293. smalltalk.Package.klass);
  4294. smalltalk.addMethod(
  4295. smalltalk.method({
  4296. selector: "named:",
  4297. category: 'accessing',
  4298. fn: function (aPackageName){
  4299. var self=this;
  4300. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  4301. return smalltalk.withContext(function($ctx1) {
  4302. var $1;
  4303. $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName);
  4304. return $1;
  4305. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  4306. args: ["aPackageName"],
  4307. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  4308. messageSends: ["packageAt:", "current"],
  4309. referencedClasses: ["Smalltalk"]
  4310. }),
  4311. smalltalk.Package.klass);
  4312. smalltalk.addMethod(
  4313. smalltalk.method({
  4314. selector: "named:ifAbsent:",
  4315. category: 'accessing',
  4316. fn: function (aPackageName,aBlock){
  4317. var self=this;
  4318. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  4319. return smalltalk.withContext(function($ctx1) {
  4320. var $1;
  4321. $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  4322. return $1;
  4323. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
  4324. args: ["aPackageName", "aBlock"],
  4325. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  4326. messageSends: ["packageAt:ifAbsent:", "current"],
  4327. referencedClasses: ["Smalltalk"]
  4328. }),
  4329. smalltalk.Package.klass);
  4330. smalltalk.addMethod(
  4331. smalltalk.method({
  4332. selector: "resetCommitPaths",
  4333. category: 'commit paths',
  4334. fn: function (){
  4335. var self=this;
  4336. return smalltalk.withContext(function($ctx1) {
  4337. self["@defaultCommitPathJs"]=nil;
  4338. self["@defaultCommitPathSt"]=nil;
  4339. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.Package.klass)})},
  4340. args: [],
  4341. source: "resetCommitPaths\x0a\x09\x09defaultCommitPathJs := nil.\x0a\x09\x09defaultCommitPathSt := nil.",
  4342. messageSends: [],
  4343. referencedClasses: []
  4344. }),
  4345. smalltalk.Package.klass);
  4346. smalltalk.addMethod(
  4347. smalltalk.method({
  4348. selector: "sortedClasses:",
  4349. category: 'sorting',
  4350. fn: function (classes){
  4351. var self=this;
  4352. var children,others,nodes,expandedClasses;
  4353. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  4354. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4355. return smalltalk.withContext(function($ctx1) {
  4356. var $1,$2;
  4357. children=[];
  4358. others=[];
  4359. _st(classes)._do_((function(each){
  4360. return smalltalk.withContext(function($ctx2) {
  4361. $1=_st(classes)._includes_(_st(each)._superclass());
  4362. if(smalltalk.assert($1)){
  4363. return _st(others)._add_(each);
  4364. } else {
  4365. return _st(children)._add_(each);
  4366. };
  4367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4368. nodes=_st(children)._collect_((function(each){
  4369. return smalltalk.withContext(function($ctx2) {
  4370. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  4371. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4372. nodes=_st(nodes)._sorted_((function(a,b){
  4373. return smalltalk.withContext(function($ctx2) {
  4374. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  4375. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  4376. expandedClasses=_st($Array())._new();
  4377. _st(nodes)._do_((function(aNode){
  4378. return smalltalk.withContext(function($ctx2) {
  4379. return _st(aNode)._traverseClassesWith_(expandedClasses);
  4380. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  4381. $2=expandedClasses;
  4382. return $2;
  4383. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})},
  4384. args: ["classes"],
  4385. 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",
  4386. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  4387. referencedClasses: ["ClassSorterNode", "Array"]
  4388. }),
  4389. smalltalk.Package.klass);
  4390. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  4391. smalltalk.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  4392. smalltalk.addMethod(
  4393. smalltalk.method({
  4394. selector: "*",
  4395. category: 'arithmetic',
  4396. fn: function (aPoint){
  4397. var self=this;
  4398. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4399. return smalltalk.withContext(function($ctx1) {
  4400. var $1;
  4401. $1=_st($Point())._x_y_(_st(self._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__star(_st(_st(aPoint)._asPoint())._y()));
  4402. return $1;
  4403. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})},
  4404. args: ["aPoint"],
  4405. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4406. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4407. referencedClasses: ["Point"]
  4408. }),
  4409. smalltalk.Point);
  4410. smalltalk.addMethod(
  4411. smalltalk.method({
  4412. selector: "+",
  4413. category: 'arithmetic',
  4414. fn: function (aPoint){
  4415. var self=this;
  4416. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4417. return smalltalk.withContext(function($ctx1) {
  4418. var $1;
  4419. $1=_st($Point())._x_y_(_st(self._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
  4420. return $1;
  4421. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})},
  4422. args: ["aPoint"],
  4423. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4424. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4425. referencedClasses: ["Point"]
  4426. }),
  4427. smalltalk.Point);
  4428. smalltalk.addMethod(
  4429. smalltalk.method({
  4430. selector: "-",
  4431. category: 'arithmetic',
  4432. fn: function (aPoint){
  4433. var self=this;
  4434. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4435. return smalltalk.withContext(function($ctx1) {
  4436. var $1;
  4437. $1=_st($Point())._x_y_(_st(self._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
  4438. return $1;
  4439. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})},
  4440. args: ["aPoint"],
  4441. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4442. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4443. referencedClasses: ["Point"]
  4444. }),
  4445. smalltalk.Point);
  4446. smalltalk.addMethod(
  4447. smalltalk.method({
  4448. selector: "/",
  4449. category: 'arithmetic',
  4450. fn: function (aPoint){
  4451. var self=this;
  4452. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4453. return smalltalk.withContext(function($ctx1) {
  4454. var $1;
  4455. $1=_st($Point())._x_y_(_st(self._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
  4456. return $1;
  4457. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})},
  4458. args: ["aPoint"],
  4459. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4460. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4461. referencedClasses: ["Point"]
  4462. }),
  4463. smalltalk.Point);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "=",
  4467. category: 'arithmetic',
  4468. fn: function (aPoint){
  4469. var self=this;
  4470. return smalltalk.withContext(function($ctx1) {
  4471. var $1;
  4472. $1=_st(_st(_st(aPoint)._class()).__eq(self._class()))._and_((function(){
  4473. return smalltalk.withContext(function($ctx2) {
  4474. return _st(_st(_st(aPoint)._x()).__eq(self._x())).__and(_st(_st(aPoint)._y()).__eq(self._y()));
  4475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4476. return $1;
  4477. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})},
  4478. args: ["aPoint"],
  4479. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  4480. messageSends: ["and:", "&", "=", "y", "x", "class"],
  4481. referencedClasses: []
  4482. }),
  4483. smalltalk.Point);
  4484. smalltalk.addMethod(
  4485. smalltalk.method({
  4486. selector: "asPoint",
  4487. category: 'converting',
  4488. fn: function (){
  4489. var self=this;
  4490. return smalltalk.withContext(function($ctx1) {
  4491. var $1;
  4492. $1=self;
  4493. return $1;
  4494. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})},
  4495. args: [],
  4496. source: "asPoint\x0a\x09^self",
  4497. messageSends: [],
  4498. referencedClasses: []
  4499. }),
  4500. smalltalk.Point);
  4501. smalltalk.addMethod(
  4502. smalltalk.method({
  4503. selector: "printOn:",
  4504. category: 'printing',
  4505. fn: function (aStream){
  4506. var self=this;
  4507. return smalltalk.withContext(function($ctx1) {
  4508. var $1;
  4509. _st(self["@x"])._printOn_(aStream);
  4510. _st(aStream)._nextPutAll_("@");
  4511. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  4512. return smalltalk.withContext(function($ctx2) {
  4513. return _st(self["@y"])._negative();
  4514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4515. if(smalltalk.assert($1)){
  4516. _st(aStream)._space();
  4517. };
  4518. _st(self["@y"])._printOn_(aStream);
  4519. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Point)})},
  4520. args: ["aStream"],
  4521. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [y negative]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  4522. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "space", "and:", "negative", "notNil"],
  4523. referencedClasses: []
  4524. }),
  4525. smalltalk.Point);
  4526. smalltalk.addMethod(
  4527. smalltalk.method({
  4528. selector: "translateBy:",
  4529. category: 'transforming',
  4530. fn: function (delta){
  4531. var self=this;
  4532. return smalltalk.withContext(function($ctx1) {
  4533. var $1;
  4534. $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  4535. return $1;
  4536. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.Point)})},
  4537. args: ["delta"],
  4538. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  4539. messageSends: ["@", "+", "y", "x"],
  4540. referencedClasses: []
  4541. }),
  4542. smalltalk.Point);
  4543. smalltalk.addMethod(
  4544. smalltalk.method({
  4545. selector: "x",
  4546. category: 'accessing',
  4547. fn: function (){
  4548. var self=this;
  4549. return smalltalk.withContext(function($ctx1) {
  4550. var $1;
  4551. $1=self["@x"];
  4552. return $1;
  4553. }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})},
  4554. args: [],
  4555. source: "x\x0a\x09^x",
  4556. messageSends: [],
  4557. referencedClasses: []
  4558. }),
  4559. smalltalk.Point);
  4560. smalltalk.addMethod(
  4561. smalltalk.method({
  4562. selector: "x:",
  4563. category: 'accessing',
  4564. fn: function (aNumber){
  4565. var self=this;
  4566. return smalltalk.withContext(function($ctx1) {
  4567. self["@x"]=aNumber;
  4568. return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})},
  4569. args: ["aNumber"],
  4570. source: "x: aNumber\x0a\x09x := aNumber",
  4571. messageSends: [],
  4572. referencedClasses: []
  4573. }),
  4574. smalltalk.Point);
  4575. smalltalk.addMethod(
  4576. smalltalk.method({
  4577. selector: "y",
  4578. category: 'accessing',
  4579. fn: function (){
  4580. var self=this;
  4581. return smalltalk.withContext(function($ctx1) {
  4582. var $1;
  4583. $1=self["@y"];
  4584. return $1;
  4585. }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})},
  4586. args: [],
  4587. source: "y\x0a\x09^y",
  4588. messageSends: [],
  4589. referencedClasses: []
  4590. }),
  4591. smalltalk.Point);
  4592. smalltalk.addMethod(
  4593. smalltalk.method({
  4594. selector: "y:",
  4595. category: 'accessing',
  4596. fn: function (aNumber){
  4597. var self=this;
  4598. return smalltalk.withContext(function($ctx1) {
  4599. self["@y"]=aNumber;
  4600. return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})},
  4601. args: ["aNumber"],
  4602. source: "y: aNumber\x0a\x09y := aNumber",
  4603. messageSends: [],
  4604. referencedClasses: []
  4605. }),
  4606. smalltalk.Point);
  4607. smalltalk.addMethod(
  4608. smalltalk.method({
  4609. selector: "heliosClass",
  4610. category: 'helios',
  4611. fn: function (){
  4612. var self=this;
  4613. return smalltalk.withContext(function($ctx1) {
  4614. return "magnitude";
  4615. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Point.klass)})},
  4616. args: [],
  4617. source: "heliosClass\x0a\x09^ 'magnitude'",
  4618. messageSends: [],
  4619. referencedClasses: []
  4620. }),
  4621. smalltalk.Point.klass);
  4622. smalltalk.addMethod(
  4623. smalltalk.method({
  4624. selector: "x:y:",
  4625. category: 'instance creation',
  4626. fn: function (aNumber,anotherNumber){
  4627. var self=this;
  4628. return smalltalk.withContext(function($ctx1) {
  4629. var $2,$3,$1;
  4630. $2=self._new();
  4631. _st($2)._x_(aNumber);
  4632. _st($2)._y_(anotherNumber);
  4633. $3=_st($2)._yourself();
  4634. $1=$3;
  4635. return $1;
  4636. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Point.klass)})},
  4637. args: ["aNumber", "anotherNumber"],
  4638. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4639. messageSends: ["x:", "new", "y:", "yourself"],
  4640. referencedClasses: []
  4641. }),
  4642. smalltalk.Point.klass);
  4643. smalltalk.addClass('ProgressHandler', smalltalk.Object, [], 'Kernel-Objects');
  4644. smalltalk.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aSubclasses of can register themselves as the current handler with\x0a`ProgressHandler class >> register`.\x0a\x0aThe default behavior is to simply iterate over the collection.";
  4645. smalltalk.addMethod(
  4646. smalltalk.method({
  4647. selector: "do:on:displaying:",
  4648. category: 'progress handling',
  4649. fn: function (aBlock,aCollection,aString){
  4650. var self=this;
  4651. return smalltalk.withContext(function($ctx1) {
  4652. _st(aCollection)._do_(aBlock);
  4653. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},smalltalk.ProgressHandler)})},
  4654. args: ["aBlock", "aCollection", "aString"],
  4655. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  4656. messageSends: ["do:"],
  4657. referencedClasses: []
  4658. }),
  4659. smalltalk.ProgressHandler);
  4660. smalltalk.ProgressHandler.klass.iVarNames = ['current'];
  4661. smalltalk.addMethod(
  4662. smalltalk.method({
  4663. selector: "current",
  4664. category: 'accessing',
  4665. fn: function (){
  4666. var self=this;
  4667. return smalltalk.withContext(function($ctx1) {
  4668. var $2,$1;
  4669. $2=self["@current"];
  4670. if(($receiver = $2) == nil || $receiver == undefined){
  4671. self["@current"]=self._new();
  4672. $1=self["@current"];
  4673. } else {
  4674. $1=$2;
  4675. };
  4676. return $1;
  4677. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ProgressHandler.klass)})},
  4678. args: [],
  4679. source: "current\x0a\x09^current ifNil: [ current := self new ]",
  4680. messageSends: ["ifNil:", "new"],
  4681. referencedClasses: []
  4682. }),
  4683. smalltalk.ProgressHandler.klass);
  4684. smalltalk.addMethod(
  4685. smalltalk.method({
  4686. selector: "initialize",
  4687. category: 'initialization',
  4688. fn: function (){
  4689. var self=this;
  4690. return smalltalk.withContext(function($ctx1) {
  4691. self._register();
  4692. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ProgressHandler.klass)})},
  4693. args: [],
  4694. source: "initialize\x0a\x09self register",
  4695. messageSends: ["register"],
  4696. referencedClasses: []
  4697. }),
  4698. smalltalk.ProgressHandler.klass);
  4699. smalltalk.addMethod(
  4700. smalltalk.method({
  4701. selector: "register",
  4702. category: 'initialization',
  4703. fn: function (){
  4704. var self=this;
  4705. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  4706. return smalltalk.withContext(function($ctx1) {
  4707. _st($ProgressHandler())._setCurrent_(self._new());
  4708. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ProgressHandler.klass)})},
  4709. args: [],
  4710. source: "register\x0a\x09ProgressHandler setCurrent: self new",
  4711. messageSends: ["setCurrent:", "new"],
  4712. referencedClasses: ["ProgressHandler"]
  4713. }),
  4714. smalltalk.ProgressHandler.klass);
  4715. smalltalk.addMethod(
  4716. smalltalk.method({
  4717. selector: "setCurrent:",
  4718. category: 'accessing',
  4719. fn: function (anHandler){
  4720. var self=this;
  4721. return smalltalk.withContext(function($ctx1) {
  4722. self["@current"]=anHandler;
  4723. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ProgressHandler.klass)})},
  4724. args: ["anHandler"],
  4725. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  4726. messageSends: [],
  4727. referencedClasses: []
  4728. }),
  4729. smalltalk.ProgressHandler.klass);
  4730. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  4731. smalltalk.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  4732. smalltalk.addMethod(
  4733. smalltalk.method({
  4734. selector: "next",
  4735. category: 'accessing',
  4736. fn: function (){
  4737. var self=this;
  4738. return smalltalk.withContext(function($ctx1) {
  4739. return Math.random();
  4740. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})},
  4741. args: [],
  4742. source: "next\x0a\x09<return Math.random()>",
  4743. messageSends: [],
  4744. referencedClasses: []
  4745. }),
  4746. smalltalk.Random);
  4747. smalltalk.addMethod(
  4748. smalltalk.method({
  4749. selector: "next:",
  4750. category: 'accessing',
  4751. fn: function (anInteger){
  4752. var self=this;
  4753. return smalltalk.withContext(function($ctx1) {
  4754. var $1;
  4755. $1=_st((1)._to_(anInteger))._collect_((function(each){
  4756. return smalltalk.withContext(function($ctx2) {
  4757. return self._next();
  4758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4759. return $1;
  4760. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})},
  4761. args: ["anInteger"],
  4762. source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]",
  4763. messageSends: ["collect:", "next", "to:"],
  4764. referencedClasses: []
  4765. }),
  4766. smalltalk.Random);
  4767. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  4768. smalltalk.Smalltalk.comment="I represent the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with class-side method `#current`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class or `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 package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work.";
  4769. smalltalk.addMethod(
  4770. smalltalk.method({
  4771. selector: "asSmalltalkException:",
  4772. category: 'error handling',
  4773. fn: function (anObject){
  4774. var self=this;
  4775. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  4776. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4777. return smalltalk.withContext(function($ctx1) {
  4778. var $2,$1;
  4779. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  4780. return smalltalk.withContext(function($ctx2) {
  4781. return _st(anObject)._isKindOf_($Error());
  4782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4783. if(smalltalk.assert($2)){
  4784. $1=anObject;
  4785. } else {
  4786. $1=_st($JavaScriptException())._on_(anObject);
  4787. };
  4788. return $1;
  4789. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
  4790. args: ["anObject"],
  4791. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  4792. messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"],
  4793. referencedClasses: ["JavaScriptException", "Error"]
  4794. }),
  4795. smalltalk.Smalltalk);
  4796. smalltalk.addMethod(
  4797. smalltalk.method({
  4798. selector: "at:",
  4799. category: 'accessing',
  4800. fn: function (aString){
  4801. var self=this;
  4802. return smalltalk.withContext(function($ctx1) {
  4803. return self[aString];
  4804. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
  4805. args: ["aString"],
  4806. source: "at: aString\x0a\x09<return self[aString]>",
  4807. messageSends: [],
  4808. referencedClasses: []
  4809. }),
  4810. smalltalk.Smalltalk);
  4811. smalltalk.addMethod(
  4812. smalltalk.method({
  4813. selector: "basicParse:",
  4814. category: 'private',
  4815. fn: function (aString){
  4816. var self=this;
  4817. return smalltalk.withContext(function($ctx1) {
  4818. return smalltalk.parser.parse(aString);
  4819. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
  4820. args: ["aString"],
  4821. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  4822. messageSends: [],
  4823. referencedClasses: []
  4824. }),
  4825. smalltalk.Smalltalk);
  4826. smalltalk.addMethod(
  4827. smalltalk.method({
  4828. selector: "classes",
  4829. category: 'classes',
  4830. fn: function (){
  4831. var self=this;
  4832. return smalltalk.withContext(function($ctx1) {
  4833. return self.classes();
  4834. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
  4835. args: [],
  4836. source: "classes\x0a\x09<return self.classes()>",
  4837. messageSends: [],
  4838. referencedClasses: []
  4839. }),
  4840. smalltalk.Smalltalk);
  4841. smalltalk.addMethod(
  4842. smalltalk.method({
  4843. selector: "createPackage:",
  4844. category: 'packages',
  4845. fn: function (packageName){
  4846. var self=this;
  4847. return smalltalk.withContext(function($ctx1) {
  4848. return smalltalk.addPackage(packageName);
  4849. return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  4850. args: ["packageName"],
  4851. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  4852. messageSends: [],
  4853. referencedClasses: []
  4854. }),
  4855. smalltalk.Smalltalk);
  4856. smalltalk.addMethod(
  4857. smalltalk.method({
  4858. selector: "createPackage:properties:",
  4859. category: 'private',
  4860. fn: function (packageName,aDict){
  4861. var self=this;
  4862. return smalltalk.withContext(function($ctx1) {
  4863. var $1,$2;
  4864. self._deprecatedAPI();
  4865. $1=_st(aDict)._isEmpty();
  4866. if(! smalltalk.assert($1)){
  4867. self._error_("createPackage:properties: called with nonempty properties");
  4868. };
  4869. $2=self._createPackage_(packageName);
  4870. return $2;
  4871. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
  4872. args: ["packageName", "aDict"],
  4873. source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
  4874. messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"],
  4875. referencedClasses: []
  4876. }),
  4877. smalltalk.Smalltalk);
  4878. smalltalk.addMethod(
  4879. smalltalk.method({
  4880. selector: "deleteClass:",
  4881. category: 'classes',
  4882. fn: function (aClass){
  4883. var self=this;
  4884. return smalltalk.withContext(function($ctx1) {
  4885. self.removeClass(aClass);
  4886. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  4887. args: ["aClass"],
  4888. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
  4889. messageSends: [],
  4890. referencedClasses: []
  4891. }),
  4892. smalltalk.Smalltalk);
  4893. smalltalk.addMethod(
  4894. smalltalk.method({
  4895. selector: "deletePackage:",
  4896. category: 'packages',
  4897. fn: function (packageName){
  4898. var self=this;
  4899. return smalltalk.withContext(function($ctx1) {
  4900. delete smalltalk.packages[packageName];
  4901. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  4902. args: ["packageName"],
  4903. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete smalltalk.packages[packageName]>",
  4904. messageSends: [],
  4905. referencedClasses: []
  4906. }),
  4907. smalltalk.Smalltalk);
  4908. smalltalk.addMethod(
  4909. smalltalk.method({
  4910. selector: "isSmalltalkObject:",
  4911. category: 'testing',
  4912. fn: function (anObject){
  4913. var self=this;
  4914. return smalltalk.withContext(function($ctx1) {
  4915. return typeof anObject.klass !== 'undefined';
  4916. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  4917. args: ["anObject"],
  4918. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return typeof anObject.klass !== 'undefined'>",
  4919. messageSends: [],
  4920. referencedClasses: []
  4921. }),
  4922. smalltalk.Smalltalk);
  4923. smalltalk.addMethod(
  4924. smalltalk.method({
  4925. selector: "packageAt:",
  4926. category: 'packages',
  4927. fn: function (packageName){
  4928. var self=this;
  4929. return smalltalk.withContext(function($ctx1) {
  4930. return self.packages[packageName];
  4931. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
  4932. args: ["packageName"],
  4933. source: "packageAt: packageName\x0a\x09<return self.packages[packageName]>",
  4934. messageSends: [],
  4935. referencedClasses: []
  4936. }),
  4937. smalltalk.Smalltalk);
  4938. smalltalk.addMethod(
  4939. smalltalk.method({
  4940. selector: "packageAt:ifAbsent:",
  4941. category: 'packages',
  4942. fn: function (packageName,aBlock){
  4943. var self=this;
  4944. return smalltalk.withContext(function($ctx1) {
  4945. var $2,$1;
  4946. $2=self._packageAt_(packageName);
  4947. $1=_st($2)._ifNil_(aBlock);
  4948. return $1;
  4949. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
  4950. args: ["packageName", "aBlock"],
  4951. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock",
  4952. messageSends: ["ifNil:", "packageAt:"],
  4953. referencedClasses: []
  4954. }),
  4955. smalltalk.Smalltalk);
  4956. smalltalk.addMethod(
  4957. smalltalk.method({
  4958. selector: "packages",
  4959. category: 'packages',
  4960. fn: function (){
  4961. var self=this;
  4962. return smalltalk.withContext(function($ctx1) {
  4963. return self.packages.all();
  4964. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
  4965. args: [],
  4966. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  4967. messageSends: [],
  4968. referencedClasses: []
  4969. }),
  4970. smalltalk.Smalltalk);
  4971. smalltalk.addMethod(
  4972. smalltalk.method({
  4973. selector: "parse:",
  4974. category: 'accessing',
  4975. fn: function (aString){
  4976. var self=this;
  4977. var result;
  4978. return smalltalk.withContext(function($ctx1) {
  4979. var $2,$3,$1;
  4980. self._try_catch_((function(){
  4981. return smalltalk.withContext(function($ctx2) {
  4982. result=self._basicParse_(aString);
  4983. return result;
  4984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){
  4985. return smalltalk.withContext(function($ctx2) {
  4986. return _st(self._parseError_parsing_(ex,aString))._signal();
  4987. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  4988. $2=result;
  4989. _st($2)._source_(aString);
  4990. $3=_st($2)._yourself();
  4991. $1=$3;
  4992. return $1;
  4993. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
  4994. args: ["aString"],
  4995. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09self \x0a\x09\x09try: [result := self basicParse: aString] \x0a\x09\x09catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  4996. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  4997. referencedClasses: []
  4998. }),
  4999. smalltalk.Smalltalk);
  5000. smalltalk.addMethod(
  5001. smalltalk.method({
  5002. selector: "parseError:parsing:",
  5003. category: 'error handling',
  5004. fn: function (anException,aString){
  5005. var self=this;
  5006. function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  5007. return smalltalk.withContext(function($ctx1) {
  5008. var $1;
  5009. $1=_st(_st($ParseError())._new())._messageText_(_st(_st(_st(_st("Parse error on line ".__comma(_st(anException)._basicAt_("line"))).__comma(" column ")).__comma(_st(anException)._basicAt_("column"))).__comma(" : Unexpected character ")).__comma(_st(anException)._basicAt_("found")));
  5010. return $1;
  5011. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
  5012. args: ["anException", "aString"],
  5013. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  5014. messageSends: ["messageText:", ",", "basicAt:", "new"],
  5015. referencedClasses: ["ParseError"]
  5016. }),
  5017. smalltalk.Smalltalk);
  5018. smalltalk.addMethod(
  5019. smalltalk.method({
  5020. selector: "pseudoVariableNames",
  5021. category: 'packages',
  5022. fn: function (){
  5023. var self=this;
  5024. return smalltalk.withContext(function($ctx1) {
  5025. var $1;
  5026. $1=["self", "super", "nil", "true", "false", "thisContext"];
  5027. return $1;
  5028. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
  5029. args: [],
  5030. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  5031. messageSends: [],
  5032. referencedClasses: []
  5033. }),
  5034. smalltalk.Smalltalk);
  5035. smalltalk.addMethod(
  5036. smalltalk.method({
  5037. selector: "readJSObject:",
  5038. category: 'accessing',
  5039. fn: function (anObject){
  5040. var self=this;
  5041. return smalltalk.withContext(function($ctx1) {
  5042. return self.readJSObject(anObject);
  5043. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  5044. args: ["anObject"],
  5045. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  5046. messageSends: [],
  5047. referencedClasses: []
  5048. }),
  5049. smalltalk.Smalltalk);
  5050. smalltalk.addMethod(
  5051. smalltalk.method({
  5052. selector: "removeClass:",
  5053. category: 'classes',
  5054. fn: function (aClass){
  5055. var self=this;
  5056. function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  5057. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5058. return smalltalk.withContext(function($ctx1) {
  5059. var $1,$2,$3;
  5060. $1=_st(aClass)._isMetaclass();
  5061. if(smalltalk.assert($1)){
  5062. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  5063. };
  5064. self._deleteClass_(aClass);
  5065. $2=_st($ClassRemoved())._new();
  5066. _st($2)._theClass_(aClass);
  5067. $3=_st($2)._yourself();
  5068. _st(_st($SystemAnnouncer())._current())._announce_($3);
  5069. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  5070. args: ["aClass"],
  5071. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  5072. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  5073. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  5074. }),
  5075. smalltalk.Smalltalk);
  5076. smalltalk.addMethod(
  5077. smalltalk.method({
  5078. selector: "removePackage:",
  5079. category: 'packages',
  5080. fn: function (packageName){
  5081. var self=this;
  5082. var pkg;
  5083. return smalltalk.withContext(function($ctx1) {
  5084. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  5085. return smalltalk.withContext(function($ctx2) {
  5086. return self._error_("Missing package: ".__comma(packageName));
  5087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5088. _st(_st(pkg)._classes())._do_((function(each){
  5089. return smalltalk.withContext(function($ctx2) {
  5090. return self._removeClass_(each);
  5091. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5092. self._deletePackage_(packageName);
  5093. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
  5094. args: ["packageName"],
  5095. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09pkg classes do: [:each |\x0a\x09\x09\x09self removeClass: each].\x0a\x09self deletePackage: packageName",
  5096. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  5097. referencedClasses: []
  5098. }),
  5099. smalltalk.Smalltalk);
  5100. smalltalk.addMethod(
  5101. smalltalk.method({
  5102. selector: "renamePackage:to:",
  5103. category: 'packages',
  5104. fn: function (packageName,newName){
  5105. var self=this;
  5106. var pkg;
  5107. return smalltalk.withContext(function($ctx1) {
  5108. var $1;
  5109. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  5110. return smalltalk.withContext(function($ctx2) {
  5111. return self._error_("Missing package: ".__comma(packageName));
  5112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5113. $1=self._packageAt_(newName);
  5114. if(($receiver = $1) == nil || $receiver == undefined){
  5115. $1;
  5116. } else {
  5117. self._error_("Already exists a package called: ".__comma(newName));
  5118. };
  5119. _st(self._basicAt_("packages"))._at_put_(newName,pkg);
  5120. _st(pkg)._name_(newName);
  5121. self._deletePackage_(packageName);
  5122. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
  5123. args: ["packageName", "newName"],
  5124. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09(self basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  5125. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
  5126. referencedClasses: []
  5127. }),
  5128. smalltalk.Smalltalk);
  5129. smalltalk.addMethod(
  5130. smalltalk.method({
  5131. selector: "reservedWords",
  5132. category: 'accessing',
  5133. fn: function (){
  5134. var self=this;
  5135. return smalltalk.withContext(function($ctx1) {
  5136. return self.reservedWords;
  5137. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
  5138. args: [],
  5139. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  5140. messageSends: [],
  5141. referencedClasses: []
  5142. }),
  5143. smalltalk.Smalltalk);
  5144. smalltalk.addMethod(
  5145. smalltalk.method({
  5146. selector: "version",
  5147. category: 'accessing',
  5148. fn: function (){
  5149. var self=this;
  5150. return smalltalk.withContext(function($ctx1) {
  5151. return "0.10";
  5152. }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
  5153. args: [],
  5154. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.10'",
  5155. messageSends: [],
  5156. referencedClasses: []
  5157. }),
  5158. smalltalk.Smalltalk);
  5159. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  5160. smalltalk.addMethod(
  5161. smalltalk.method({
  5162. selector: "current",
  5163. category: 'accessing',
  5164. fn: function (){
  5165. var self=this;
  5166. return smalltalk.withContext(function($ctx1) {
  5167. return smalltalk;
  5168. return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
  5169. args: [],
  5170. source: "current\x0a\x09<return smalltalk>",
  5171. messageSends: [],
  5172. referencedClasses: []
  5173. }),
  5174. smalltalk.Smalltalk.klass);
  5175. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  5176. smalltalk.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  5177. smalltalk.addMethod(
  5178. smalltalk.method({
  5179. selector: "clearInterval",
  5180. category: 'timeout/interval',
  5181. fn: function (){
  5182. var self=this;
  5183. return smalltalk.withContext(function($ctx1) {
  5184. var interval = self["@rawTimeout"];
  5185. clearInterval(interval);
  5186. ;
  5187. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})},
  5188. args: [],
  5189. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  5190. messageSends: [],
  5191. referencedClasses: []
  5192. }),
  5193. smalltalk.Timeout);
  5194. smalltalk.addMethod(
  5195. smalltalk.method({
  5196. selector: "clearTimeout",
  5197. category: 'timeout/interval',
  5198. fn: function (){
  5199. var self=this;
  5200. return smalltalk.withContext(function($ctx1) {
  5201. var timeout = self["@rawTimeout"];
  5202. clearTimeout(timeout);
  5203. ;
  5204. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})},
  5205. args: [],
  5206. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  5207. messageSends: [],
  5208. referencedClasses: []
  5209. }),
  5210. smalltalk.Timeout);
  5211. smalltalk.addMethod(
  5212. smalltalk.method({
  5213. selector: "rawTimeout:",
  5214. category: 'accessing',
  5215. fn: function (anObject){
  5216. var self=this;
  5217. return smalltalk.withContext(function($ctx1) {
  5218. self["@rawTimeout"]=anObject;
  5219. return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})},
  5220. args: ["anObject"],
  5221. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  5222. messageSends: [],
  5223. referencedClasses: []
  5224. }),
  5225. smalltalk.Timeout);
  5226. smalltalk.addMethod(
  5227. smalltalk.method({
  5228. selector: "on:",
  5229. category: 'instance creation',
  5230. fn: function (anObject){
  5231. var self=this;
  5232. return smalltalk.withContext(function($ctx1) {
  5233. var $2,$3,$1;
  5234. $2=self._new();
  5235. _st($2)._rawTimeout_(anObject);
  5236. $3=_st($2)._yourself();
  5237. $1=$3;
  5238. return $1;
  5239. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})},
  5240. args: ["anObject"],
  5241. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  5242. messageSends: ["rawTimeout:", "new", "yourself"],
  5243. referencedClasses: []
  5244. }),
  5245. smalltalk.Timeout.klass);
  5246. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  5247. smalltalk.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  5248. smalltalk.addMethod(
  5249. smalltalk.method({
  5250. selector: "asJSON",
  5251. category: 'converting',
  5252. fn: function (){
  5253. var self=this;
  5254. return smalltalk.withContext(function($ctx1) {
  5255. var $1;
  5256. $1=null;
  5257. return $1;
  5258. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})},
  5259. args: [],
  5260. source: "asJSON\x0a\x09^null",
  5261. messageSends: [],
  5262. referencedClasses: []
  5263. }),
  5264. smalltalk.UndefinedObject);
  5265. smalltalk.addMethod(
  5266. smalltalk.method({
  5267. selector: "deepCopy",
  5268. category: 'copying',
  5269. fn: function (){
  5270. var self=this;
  5271. return smalltalk.withContext(function($ctx1) {
  5272. var $1;
  5273. $1=self;
  5274. return $1;
  5275. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})},
  5276. args: [],
  5277. source: "deepCopy\x0a\x09^self",
  5278. messageSends: [],
  5279. referencedClasses: []
  5280. }),
  5281. smalltalk.UndefinedObject);
  5282. smalltalk.addMethod(
  5283. smalltalk.method({
  5284. selector: "ifNil:",
  5285. category: 'testing',
  5286. fn: function (aBlock){
  5287. var self=this;
  5288. return smalltalk.withContext(function($ctx1) {
  5289. var $2,$1;
  5290. $2=self;
  5291. $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
  5292. return smalltalk.withContext(function($ctx2) {
  5293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5294. return $1;
  5295. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  5296. args: ["aBlock"],
  5297. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  5298. messageSends: ["ifNil:ifNotNil:"],
  5299. referencedClasses: []
  5300. }),
  5301. smalltalk.UndefinedObject);
  5302. smalltalk.addMethod(
  5303. smalltalk.method({
  5304. selector: "ifNil:ifNotNil:",
  5305. category: 'testing',
  5306. fn: function (aBlock,anotherBlock){
  5307. var self=this;
  5308. return smalltalk.withContext(function($ctx1) {
  5309. var $1;
  5310. $1=_st(aBlock)._value();
  5311. return $1;
  5312. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  5313. args: ["aBlock", "anotherBlock"],
  5314. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  5315. messageSends: ["value"],
  5316. referencedClasses: []
  5317. }),
  5318. smalltalk.UndefinedObject);
  5319. smalltalk.addMethod(
  5320. smalltalk.method({
  5321. selector: "ifNotNil:",
  5322. category: 'testing',
  5323. fn: function (aBlock){
  5324. var self=this;
  5325. return smalltalk.withContext(function($ctx1) {
  5326. var $1;
  5327. $1=self;
  5328. return $1;
  5329. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  5330. args: ["aBlock"],
  5331. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  5332. messageSends: [],
  5333. referencedClasses: []
  5334. }),
  5335. smalltalk.UndefinedObject);
  5336. smalltalk.addMethod(
  5337. smalltalk.method({
  5338. selector: "ifNotNil:ifNil:",
  5339. category: 'testing',
  5340. fn: function (aBlock,anotherBlock){
  5341. var self=this;
  5342. return smalltalk.withContext(function($ctx1) {
  5343. var $1;
  5344. $1=_st(anotherBlock)._value();
  5345. return $1;
  5346. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  5347. args: ["aBlock", "anotherBlock"],
  5348. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  5349. messageSends: ["value"],
  5350. referencedClasses: []
  5351. }),
  5352. smalltalk.UndefinedObject);
  5353. smalltalk.addMethod(
  5354. smalltalk.method({
  5355. selector: "isImmutable",
  5356. category: 'testing',
  5357. fn: function (){
  5358. var self=this;
  5359. return smalltalk.withContext(function($ctx1) {
  5360. return true;
  5361. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})},
  5362. args: [],
  5363. source: "isImmutable\x0a\x09^ true",
  5364. messageSends: [],
  5365. referencedClasses: []
  5366. }),
  5367. smalltalk.UndefinedObject);
  5368. smalltalk.addMethod(
  5369. smalltalk.method({
  5370. selector: "isNil",
  5371. category: 'testing',
  5372. fn: function (){
  5373. var self=this;
  5374. return smalltalk.withContext(function($ctx1) {
  5375. return true;
  5376. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})},
  5377. args: [],
  5378. source: "isNil\x0a\x09^true",
  5379. messageSends: [],
  5380. referencedClasses: []
  5381. }),
  5382. smalltalk.UndefinedObject);
  5383. smalltalk.addMethod(
  5384. smalltalk.method({
  5385. selector: "notNil",
  5386. category: 'testing',
  5387. fn: function (){
  5388. var self=this;
  5389. return smalltalk.withContext(function($ctx1) {
  5390. return false;
  5391. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})},
  5392. args: [],
  5393. source: "notNil\x0a\x09^false",
  5394. messageSends: [],
  5395. referencedClasses: []
  5396. }),
  5397. smalltalk.UndefinedObject);
  5398. smalltalk.addMethod(
  5399. smalltalk.method({
  5400. selector: "printOn:",
  5401. category: 'printing',
  5402. fn: function (aStream){
  5403. var self=this;
  5404. return smalltalk.withContext(function($ctx1) {
  5405. _st(aStream)._nextPutAll_("nil");
  5406. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})},
  5407. args: ["aStream"],
  5408. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5409. messageSends: ["nextPutAll:"],
  5410. referencedClasses: []
  5411. }),
  5412. smalltalk.UndefinedObject);
  5413. smalltalk.addMethod(
  5414. smalltalk.method({
  5415. selector: "shallowCopy",
  5416. category: 'copying',
  5417. fn: function (){
  5418. var self=this;
  5419. return smalltalk.withContext(function($ctx1) {
  5420. var $1;
  5421. $1=self;
  5422. return $1;
  5423. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})},
  5424. args: [],
  5425. source: "shallowCopy\x0a\x09^self",
  5426. messageSends: [],
  5427. referencedClasses: []
  5428. }),
  5429. smalltalk.UndefinedObject);
  5430. smalltalk.addMethod(
  5431. smalltalk.method({
  5432. selector: "subclass:instanceVariableNames:",
  5433. category: 'class creation',
  5434. fn: function (aString,anotherString){
  5435. var self=this;
  5436. return smalltalk.withContext(function($ctx1) {
  5437. var $1;
  5438. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5439. return $1;
  5440. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})},
  5441. args: ["aString", "anotherString"],
  5442. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  5443. messageSends: ["subclass:instanceVariableNames:package:"],
  5444. referencedClasses: []
  5445. }),
  5446. smalltalk.UndefinedObject);
  5447. smalltalk.addMethod(
  5448. smalltalk.method({
  5449. selector: "subclass:instanceVariableNames:category:",
  5450. category: 'class creation',
  5451. fn: function (aString,aString2,aString3){
  5452. var self=this;
  5453. return smalltalk.withContext(function($ctx1) {
  5454. var $1;
  5455. self._deprecatedAPI();
  5456. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5457. return $1;
  5458. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  5459. args: ["aString", "aString2", "aString3"],
  5460. 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",
  5461. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5462. referencedClasses: []
  5463. }),
  5464. smalltalk.UndefinedObject);
  5465. smalltalk.addMethod(
  5466. smalltalk.method({
  5467. selector: "subclass:instanceVariableNames:package:",
  5468. category: 'class creation',
  5469. fn: function (aString,aString2,aString3){
  5470. var self=this;
  5471. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5472. return smalltalk.withContext(function($ctx1) {
  5473. var $1;
  5474. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  5475. return $1;
  5476. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  5477. args: ["aString", "aString2", "aString3"],
  5478. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5479. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  5480. referencedClasses: ["ClassBuilder"]
  5481. }),
  5482. smalltalk.UndefinedObject);
  5483. smalltalk.addMethod(
  5484. smalltalk.method({
  5485. selector: "new",
  5486. category: 'instance creation',
  5487. fn: function (){
  5488. var self=this;
  5489. return smalltalk.withContext(function($ctx1) {
  5490. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5491. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})},
  5492. args: [],
  5493. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5494. messageSends: ["error:"],
  5495. referencedClasses: []
  5496. }),
  5497. smalltalk.UndefinedObject.klass);
  5498. smalltalk.addMethod(
  5499. smalltalk.method({
  5500. selector: "asJavaScriptSelector",
  5501. category: '*Kernel-Objects',
  5502. fn: function (){
  5503. var self=this;
  5504. return smalltalk.withContext(function($ctx1) {
  5505. var $1;
  5506. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  5507. return $1;
  5508. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
  5509. args: [],
  5510. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  5511. messageSends: ["replace:with:"],
  5512. referencedClasses: []
  5513. }),
  5514. smalltalk.String);