Kernel-Objects.js 157 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953
  1. smalltalk.addPackage('Kernel-Objects');
  2. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  3. smalltalk.Object.comment="*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.\x0a\x0aObject provides default behavior common to all normal objects, such as:\x0a\x0a- access\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aObject has no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aObjects understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\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=_st(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(_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(_st(self)._class())._allInstanceVariableNames())._do_((function(each){
  68. return smalltalk.withContext(function($ctx2) {
  69. return _st(variables)._at_put_(each,_st(_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_(_st(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=_st(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=_st(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=_st(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(_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(_st(smalltalk.getThisContext())._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_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. _st(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: "instVarAt:",
  434. category: 'accessing',
  435. fn: function (aString){
  436. var self=this;
  437. return smalltalk.withContext(function($ctx1) {
  438. return self['@'+aString] ;
  439. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})},
  440. args: ["aString"],
  441. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  442. messageSends: [],
  443. referencedClasses: []
  444. }),
  445. smalltalk.Object);
  446. smalltalk.addMethod(
  447. smalltalk.method({
  448. selector: "instVarAt:put:",
  449. category: 'accessing',
  450. fn: function (aString,anObject){
  451. var self=this;
  452. return smalltalk.withContext(function($ctx1) {
  453. self['@' + aString] = anObject ;
  454. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  455. args: ["aString", "anObject"],
  456. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  457. messageSends: [],
  458. referencedClasses: []
  459. }),
  460. smalltalk.Object);
  461. smalltalk.addMethod(
  462. smalltalk.method({
  463. selector: "isBehavior",
  464. category: 'testing',
  465. fn: function (){
  466. var self=this;
  467. return smalltalk.withContext(function($ctx1) {
  468. return false;
  469. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})},
  470. args: [],
  471. source: "isBehavior\x0a\x09^ false",
  472. messageSends: [],
  473. referencedClasses: []
  474. }),
  475. smalltalk.Object);
  476. smalltalk.addMethod(
  477. smalltalk.method({
  478. selector: "isBoolean",
  479. category: 'testing',
  480. fn: function (){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) {
  483. return false;
  484. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})},
  485. args: [],
  486. source: "isBoolean\x0a\x09^ false",
  487. messageSends: [],
  488. referencedClasses: []
  489. }),
  490. smalltalk.Object);
  491. smalltalk.addMethod(
  492. smalltalk.method({
  493. selector: "isClass",
  494. category: 'testing',
  495. fn: function (){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) {
  498. return false;
  499. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})},
  500. args: [],
  501. source: "isClass\x0a\x09^false",
  502. messageSends: [],
  503. referencedClasses: []
  504. }),
  505. smalltalk.Object);
  506. smalltalk.addMethod(
  507. smalltalk.method({
  508. selector: "isCompiledMethod",
  509. category: 'testing',
  510. fn: function (){
  511. var self=this;
  512. return smalltalk.withContext(function($ctx1) {
  513. return false;
  514. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})},
  515. args: [],
  516. source: "isCompiledMethod\x0a\x09^ false",
  517. messageSends: [],
  518. referencedClasses: []
  519. }),
  520. smalltalk.Object);
  521. smalltalk.addMethod(
  522. smalltalk.method({
  523. selector: "isImmutable",
  524. category: 'testing',
  525. fn: function (){
  526. var self=this;
  527. return smalltalk.withContext(function($ctx1) {
  528. return false;
  529. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})},
  530. args: [],
  531. source: "isImmutable\x0a\x09^ false",
  532. messageSends: [],
  533. referencedClasses: []
  534. }),
  535. smalltalk.Object);
  536. smalltalk.addMethod(
  537. smalltalk.method({
  538. selector: "isKindOf:",
  539. category: 'testing',
  540. fn: function (aClass){
  541. var self=this;
  542. return smalltalk.withContext(function($ctx1) {
  543. var $2,$1;
  544. $2=_st(self)._isMemberOf_(aClass);
  545. if(smalltalk.assert($2)){
  546. $1=true;
  547. } else {
  548. $1=_st(_st(self)._class())._inheritsFrom_(aClass);
  549. };
  550. return $1;
  551. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})},
  552. args: ["aClass"],
  553. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]",
  554. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  555. referencedClasses: []
  556. }),
  557. smalltalk.Object);
  558. smalltalk.addMethod(
  559. smalltalk.method({
  560. selector: "isMemberOf:",
  561. category: 'testing',
  562. fn: function (aClass){
  563. var self=this;
  564. return smalltalk.withContext(function($ctx1) {
  565. var $1;
  566. $1=_st(_st(self)._class()).__eq(aClass);
  567. return $1;
  568. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})},
  569. args: ["aClass"],
  570. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  571. messageSends: ["=", "class"],
  572. referencedClasses: []
  573. }),
  574. smalltalk.Object);
  575. smalltalk.addMethod(
  576. smalltalk.method({
  577. selector: "isMetaclass",
  578. category: 'testing',
  579. fn: function (){
  580. var self=this;
  581. return smalltalk.withContext(function($ctx1) {
  582. return false;
  583. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})},
  584. args: [],
  585. source: "isMetaclass\x0a\x09^false",
  586. messageSends: [],
  587. referencedClasses: []
  588. }),
  589. smalltalk.Object);
  590. smalltalk.addMethod(
  591. smalltalk.method({
  592. selector: "isNil",
  593. category: 'testing',
  594. fn: function (){
  595. var self=this;
  596. return smalltalk.withContext(function($ctx1) {
  597. return false;
  598. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})},
  599. args: [],
  600. source: "isNil\x0a\x09^false",
  601. messageSends: [],
  602. referencedClasses: []
  603. }),
  604. smalltalk.Object);
  605. smalltalk.addMethod(
  606. smalltalk.method({
  607. selector: "isNumber",
  608. category: 'testing',
  609. fn: function (){
  610. var self=this;
  611. return smalltalk.withContext(function($ctx1) {
  612. return false;
  613. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})},
  614. args: [],
  615. source: "isNumber\x0a\x09^false",
  616. messageSends: [],
  617. referencedClasses: []
  618. }),
  619. smalltalk.Object);
  620. smalltalk.addMethod(
  621. smalltalk.method({
  622. selector: "isPackage",
  623. category: 'testing',
  624. fn: function (){
  625. var self=this;
  626. return smalltalk.withContext(function($ctx1) {
  627. return false;
  628. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})},
  629. args: [],
  630. source: "isPackage\x0a\x09^ false",
  631. messageSends: [],
  632. referencedClasses: []
  633. }),
  634. smalltalk.Object);
  635. smalltalk.addMethod(
  636. smalltalk.method({
  637. selector: "isParseFailure",
  638. category: 'testing',
  639. fn: function (){
  640. var self=this;
  641. return smalltalk.withContext(function($ctx1) {
  642. return false;
  643. }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})},
  644. args: [],
  645. source: "isParseFailure\x0a\x09^false",
  646. messageSends: [],
  647. referencedClasses: []
  648. }),
  649. smalltalk.Object);
  650. smalltalk.addMethod(
  651. smalltalk.method({
  652. selector: "isString",
  653. category: 'testing',
  654. fn: function (){
  655. var self=this;
  656. return smalltalk.withContext(function($ctx1) {
  657. return false;
  658. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})},
  659. args: [],
  660. source: "isString\x0a\x09^false",
  661. messageSends: [],
  662. referencedClasses: []
  663. }),
  664. smalltalk.Object);
  665. smalltalk.addMethod(
  666. smalltalk.method({
  667. selector: "isSymbol",
  668. category: 'testing',
  669. fn: function (){
  670. var self=this;
  671. return smalltalk.withContext(function($ctx1) {
  672. return false;
  673. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})},
  674. args: [],
  675. source: "isSymbol\x0a\x09^false",
  676. messageSends: [],
  677. referencedClasses: []
  678. }),
  679. smalltalk.Object);
  680. smalltalk.addMethod(
  681. smalltalk.method({
  682. selector: "notNil",
  683. category: 'testing',
  684. fn: function (){
  685. var self=this;
  686. return smalltalk.withContext(function($ctx1) {
  687. var $1;
  688. $1=_st(_st(self)._isNil())._not();
  689. return $1;
  690. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})},
  691. args: [],
  692. source: "notNil\x0a\x09^self isNil not",
  693. messageSends: ["not", "isNil"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.Object);
  697. smalltalk.addMethod(
  698. smalltalk.method({
  699. selector: "perform:",
  700. category: 'message handling',
  701. fn: function (aString){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) {
  704. var $1;
  705. $1=_st(self)._perform_withArguments_(aString,[]);
  706. return $1;
  707. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})},
  708. args: ["aString"],
  709. source: "perform: aString\x0a\x09^self perform: aString withArguments: #()",
  710. messageSends: ["perform:withArguments:"],
  711. referencedClasses: []
  712. }),
  713. smalltalk.Object);
  714. smalltalk.addMethod(
  715. smalltalk.method({
  716. selector: "perform:withArguments:",
  717. category: 'message handling',
  718. fn: function (aString,aCollection){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) {
  721. return smalltalk.send(self, aString._asSelector(), aCollection);
  722. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  723. args: ["aString", "aCollection"],
  724. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  725. messageSends: [],
  726. referencedClasses: []
  727. }),
  728. smalltalk.Object);
  729. smalltalk.addMethod(
  730. smalltalk.method({
  731. selector: "postCopy",
  732. category: 'copying',
  733. fn: function (){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) {
  736. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})},
  737. args: [],
  738. source: "postCopy",
  739. messageSends: [],
  740. referencedClasses: []
  741. }),
  742. smalltalk.Object);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "printOn:",
  746. category: 'printing',
  747. fn: function (aStream){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$3,$2;
  751. $1=aStream;
  752. $3=_st(_st(_st(_st(self)._class())._name())._first())._isVowel();
  753. if(smalltalk.assert($3)){
  754. $2="an ";
  755. } else {
  756. $2="a ";
  757. };
  758. _st($1)._nextPutAll_($2);
  759. _st(aStream)._nextPutAll_(_st(_st(self)._class())._name());
  760. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})},
  761. args: ["aStream"],
  762. 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",
  763. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  764. referencedClasses: []
  765. }),
  766. smalltalk.Object);
  767. smalltalk.addMethod(
  768. smalltalk.method({
  769. selector: "printString",
  770. category: 'printing',
  771. fn: function (){
  772. var self=this;
  773. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  774. return smalltalk.withContext(function($ctx1) {
  775. var $1;
  776. $1=_st($String())._streamContents_((function(stream){
  777. return smalltalk.withContext(function($ctx2) {
  778. return _st(self)._printOn_(stream);
  779. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  780. return $1;
  781. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})},
  782. args: [],
  783. source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]",
  784. messageSends: ["streamContents:", "printOn:"],
  785. referencedClasses: ["String"]
  786. }),
  787. smalltalk.Object);
  788. smalltalk.addMethod(
  789. smalltalk.method({
  790. selector: "putOn:",
  791. category: 'streaming',
  792. fn: function (aStream){
  793. var self=this;
  794. return smalltalk.withContext(function($ctx1) {
  795. _st(aStream)._nextPut_(self);
  796. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})},
  797. args: ["aStream"],
  798. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  799. messageSends: ["nextPut:"],
  800. referencedClasses: []
  801. }),
  802. smalltalk.Object);
  803. smalltalk.addMethod(
  804. smalltalk.method({
  805. selector: "respondsTo:",
  806. category: 'testing',
  807. fn: function (aSelector){
  808. var self=this;
  809. return smalltalk.withContext(function($ctx1) {
  810. var $1;
  811. $1=_st(_st(self)._class())._canUnderstand_(aSelector);
  812. return $1;
  813. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})},
  814. args: ["aSelector"],
  815. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  816. messageSends: ["canUnderstand:", "class"],
  817. referencedClasses: []
  818. }),
  819. smalltalk.Object);
  820. smalltalk.addMethod(
  821. smalltalk.method({
  822. selector: "shallowCopy",
  823. category: 'copying',
  824. fn: function (){
  825. var self=this;
  826. return smalltalk.withContext(function($ctx1) {
  827. var copy = self.klass._new();
  828. for(var i in self) {
  829. if(/^@.+/.test(i)) {
  830. copy[i] = self[i];
  831. }
  832. }
  833. return copy;
  834. ;
  835. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})},
  836. args: [],
  837. 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>",
  838. messageSends: [],
  839. referencedClasses: []
  840. }),
  841. smalltalk.Object);
  842. smalltalk.addMethod(
  843. smalltalk.method({
  844. selector: "shouldNotImplement",
  845. category: 'error handling',
  846. fn: function (){
  847. var self=this;
  848. return smalltalk.withContext(function($ctx1) {
  849. _st(self)._error_(_st("This method should not be implemented in ").__comma(_st(_st(self)._class())._name()));
  850. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})},
  851. args: [],
  852. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  853. messageSends: ["error:", ",", "name", "class"],
  854. referencedClasses: []
  855. }),
  856. smalltalk.Object);
  857. smalltalk.addMethod(
  858. smalltalk.method({
  859. selector: "size",
  860. category: 'accessing',
  861. fn: function (){
  862. var self=this;
  863. return smalltalk.withContext(function($ctx1) {
  864. _st(self)._error_("Object not indexable");
  865. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})},
  866. args: [],
  867. source: "size\x0a\x09self error: 'Object not indexable'",
  868. messageSends: ["error:"],
  869. referencedClasses: []
  870. }),
  871. smalltalk.Object);
  872. smalltalk.addMethod(
  873. smalltalk.method({
  874. selector: "subclassResponsibility",
  875. category: 'error handling',
  876. fn: function (){
  877. var self=this;
  878. return smalltalk.withContext(function($ctx1) {
  879. _st(self)._error_("This method is a responsibility of a subclass");
  880. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})},
  881. args: [],
  882. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  883. messageSends: ["error:"],
  884. referencedClasses: []
  885. }),
  886. smalltalk.Object);
  887. smalltalk.addMethod(
  888. smalltalk.method({
  889. selector: "test",
  890. category: 'converting',
  891. fn: function (){
  892. var self=this;
  893. var a;
  894. return smalltalk.withContext(function($ctx1) {
  895. a=(1);
  896. _st(self)._halt();
  897. return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})},
  898. args: [],
  899. source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt",
  900. messageSends: ["halt"],
  901. referencedClasses: []
  902. }),
  903. smalltalk.Object);
  904. smalltalk.addMethod(
  905. smalltalk.method({
  906. selector: "throw:",
  907. category: 'error handling',
  908. fn: function (anObject){
  909. var self=this;
  910. return smalltalk.withContext(function($ctx1) {
  911. throw anObject ;
  912. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})},
  913. args: ["anObject"],
  914. source: "throw: anObject\x0a\x09< throw anObject >",
  915. messageSends: [],
  916. referencedClasses: []
  917. }),
  918. smalltalk.Object);
  919. smalltalk.addMethod(
  920. smalltalk.method({
  921. selector: "try:catch:",
  922. category: 'error handling',
  923. fn: function (aBlock,anotherBlock){
  924. var self=this;
  925. return smalltalk.withContext(function($ctx1) {
  926. try{return aBlock()} catch(e) {return anotherBlock(e)};
  927. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  928. args: ["aBlock", "anotherBlock"],
  929. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock()} catch(e) {return anotherBlock(e)}>",
  930. messageSends: [],
  931. referencedClasses: []
  932. }),
  933. smalltalk.Object);
  934. smalltalk.addMethod(
  935. smalltalk.method({
  936. selector: "value",
  937. category: 'accessing',
  938. fn: function (){
  939. var self=this;
  940. return smalltalk.withContext(function($ctx1) {
  941. return self.valueOf();
  942. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})},
  943. args: [],
  944. source: "value\x0a\x09<return self.valueOf()>",
  945. messageSends: [],
  946. referencedClasses: []
  947. }),
  948. smalltalk.Object);
  949. smalltalk.addMethod(
  950. smalltalk.method({
  951. selector: "yourself",
  952. category: 'accessing',
  953. fn: function (){
  954. var self=this;
  955. return smalltalk.withContext(function($ctx1) {
  956. var $1;
  957. $1=self;
  958. return $1;
  959. }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})},
  960. args: [],
  961. source: "yourself\x0a\x09^self",
  962. messageSends: [],
  963. referencedClasses: []
  964. }),
  965. smalltalk.Object);
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "~=",
  969. category: 'comparing',
  970. fn: function (anObject){
  971. var self=this;
  972. return smalltalk.withContext(function($ctx1) {
  973. var $1;
  974. $1=_st(_st(self).__eq(anObject)).__eq(false);
  975. return $1;
  976. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})},
  977. args: ["anObject"],
  978. source: "~= anObject\x0a\x09^(self = anObject) = false",
  979. messageSends: ["="],
  980. referencedClasses: []
  981. }),
  982. smalltalk.Object);
  983. smalltalk.addMethod(
  984. smalltalk.method({
  985. selector: "~~",
  986. category: 'comparing',
  987. fn: function (anObject){
  988. var self=this;
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=_st(_st(self).__eq_eq(anObject)).__eq(false);
  992. return $1;
  993. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})},
  994. args: ["anObject"],
  995. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  996. messageSends: ["=", "=="],
  997. referencedClasses: []
  998. }),
  999. smalltalk.Object);
  1000. smalltalk.addMethod(
  1001. smalltalk.method({
  1002. selector: "initialize",
  1003. category: 'initialization',
  1004. fn: function (){
  1005. var self=this;
  1006. return smalltalk.withContext(function($ctx1) {
  1007. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})},
  1008. args: [],
  1009. source: "initialize\x0a\x09\x22no op\x22",
  1010. messageSends: [],
  1011. referencedClasses: []
  1012. }),
  1013. smalltalk.Object.klass);
  1014. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1015. smalltalk.Boolean.comment="Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0aBoolean defines the protocol for logic testing operations and conditional control structures for the logical values.\x0aBoolean instances are weither `true` or `false`."
  1016. smalltalk.addMethod(
  1017. smalltalk.method({
  1018. selector: "&",
  1019. category: 'controlling',
  1020. fn: function (aBoolean){
  1021. var self=this;
  1022. return smalltalk.withContext(function($ctx1) {
  1023. if(self == true) {
  1024. return aBoolean;
  1025. } else {
  1026. return false;
  1027. }
  1028. ;
  1029. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1030. args: ["aBoolean"],
  1031. 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>",
  1032. messageSends: [],
  1033. referencedClasses: []
  1034. }),
  1035. smalltalk.Boolean);
  1036. smalltalk.addMethod(
  1037. smalltalk.method({
  1038. selector: "=",
  1039. category: 'comparing',
  1040. fn: function (aBoolean){
  1041. var self=this;
  1042. return smalltalk.withContext(function($ctx1) {
  1043. if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
  1044. return false;
  1045. }
  1046. return Boolean(self == true) == aBoolean
  1047. ;
  1048. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1049. args: ["aBoolean"],
  1050. 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>",
  1051. messageSends: [],
  1052. referencedClasses: []
  1053. }),
  1054. smalltalk.Boolean);
  1055. smalltalk.addMethod(
  1056. smalltalk.method({
  1057. selector: "==",
  1058. category: 'comparing',
  1059. fn: function (aBoolean){
  1060. var self=this;
  1061. return smalltalk.withContext(function($ctx1) {
  1062. var $1;
  1063. $1=_st(self).__eq(aBoolean);
  1064. return $1;
  1065. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1066. args: ["aBoolean"],
  1067. source: "== aBoolean\x0a\x09^self = aBoolean",
  1068. messageSends: ["="],
  1069. referencedClasses: []
  1070. }),
  1071. smalltalk.Boolean);
  1072. smalltalk.addMethod(
  1073. smalltalk.method({
  1074. selector: "and:",
  1075. category: 'controlling',
  1076. fn: function (aBlock){
  1077. var self=this;
  1078. return smalltalk.withContext(function($ctx1) {
  1079. var $2,$1;
  1080. $2=_st(self).__eq(true);
  1081. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1082. return smalltalk.withContext(function($ctx2) {
  1083. return false;
  1084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1085. return $1;
  1086. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})},
  1087. args: ["aBlock"],
  1088. source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]",
  1089. messageSends: ["ifTrue:ifFalse:", "="],
  1090. referencedClasses: []
  1091. }),
  1092. smalltalk.Boolean);
  1093. smalltalk.addMethod(
  1094. smalltalk.method({
  1095. selector: "asJSON",
  1096. category: 'converting',
  1097. fn: function (){
  1098. var self=this;
  1099. return smalltalk.withContext(function($ctx1) {
  1100. var $1;
  1101. $1=self;
  1102. return $1;
  1103. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})},
  1104. args: [],
  1105. source: "asJSON\x0a\x09^self",
  1106. messageSends: [],
  1107. referencedClasses: []
  1108. }),
  1109. smalltalk.Boolean);
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "asString",
  1113. category: 'converting',
  1114. fn: function (){
  1115. var self=this;
  1116. return smalltalk.withContext(function($ctx1) {
  1117. return self.toString() ;
  1118. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})},
  1119. args: [],
  1120. source: "asString\x0a\x09< return self.toString() >",
  1121. messageSends: [],
  1122. referencedClasses: []
  1123. }),
  1124. smalltalk.Boolean);
  1125. smalltalk.addMethod(
  1126. smalltalk.method({
  1127. selector: "deepCopy",
  1128. category: 'copying',
  1129. fn: function (){
  1130. var self=this;
  1131. return smalltalk.withContext(function($ctx1) {
  1132. var $1;
  1133. $1=self;
  1134. return $1;
  1135. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})},
  1136. args: [],
  1137. source: "deepCopy\x0a\x09^self",
  1138. messageSends: [],
  1139. referencedClasses: []
  1140. }),
  1141. smalltalk.Boolean);
  1142. smalltalk.addMethod(
  1143. smalltalk.method({
  1144. selector: "ifFalse:",
  1145. category: 'controlling',
  1146. fn: function (aBlock){
  1147. var self=this;
  1148. return smalltalk.withContext(function($ctx1) {
  1149. var $2,$1;
  1150. $2=self;
  1151. $1=_st($2)._ifTrue_ifFalse_((function(){
  1152. return smalltalk.withContext(function($ctx2) {
  1153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1154. return $1;
  1155. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})},
  1156. args: ["aBlock"],
  1157. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1158. messageSends: ["ifTrue:ifFalse:"],
  1159. referencedClasses: []
  1160. }),
  1161. smalltalk.Boolean);
  1162. smalltalk.addMethod(
  1163. smalltalk.method({
  1164. selector: "ifFalse:ifTrue:",
  1165. category: 'controlling',
  1166. fn: function (aBlock,anotherBlock){
  1167. var self=this;
  1168. return smalltalk.withContext(function($ctx1) {
  1169. var $2,$1;
  1170. $2=self;
  1171. $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
  1172. return $1;
  1173. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1174. args: ["aBlock", "anotherBlock"],
  1175. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1176. messageSends: ["ifTrue:ifFalse:"],
  1177. referencedClasses: []
  1178. }),
  1179. smalltalk.Boolean);
  1180. smalltalk.addMethod(
  1181. smalltalk.method({
  1182. selector: "ifTrue:",
  1183. category: 'controlling',
  1184. fn: function (aBlock){
  1185. var self=this;
  1186. return smalltalk.withContext(function($ctx1) {
  1187. var $2,$1;
  1188. $2=self;
  1189. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1190. return smalltalk.withContext(function($ctx2) {
  1191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1192. return $1;
  1193. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})},
  1194. args: ["aBlock"],
  1195. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1196. messageSends: ["ifTrue:ifFalse:"],
  1197. referencedClasses: []
  1198. }),
  1199. smalltalk.Boolean);
  1200. smalltalk.addMethod(
  1201. smalltalk.method({
  1202. selector: "ifTrue:ifFalse:",
  1203. category: 'controlling',
  1204. fn: function (aBlock,anotherBlock){
  1205. var self=this;
  1206. return smalltalk.withContext(function($ctx1) {
  1207. if(self == true) {
  1208. return aBlock();
  1209. } else {
  1210. return anotherBlock();
  1211. }
  1212. ;
  1213. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1214. args: ["aBlock", "anotherBlock"],
  1215. 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>",
  1216. messageSends: [],
  1217. referencedClasses: []
  1218. }),
  1219. smalltalk.Boolean);
  1220. smalltalk.addMethod(
  1221. smalltalk.method({
  1222. selector: "isBoolean",
  1223. category: 'testing',
  1224. fn: function (){
  1225. var self=this;
  1226. return smalltalk.withContext(function($ctx1) {
  1227. return true;
  1228. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})},
  1229. args: [],
  1230. source: "isBoolean\x0a\x09^ true",
  1231. messageSends: [],
  1232. referencedClasses: []
  1233. }),
  1234. smalltalk.Boolean);
  1235. smalltalk.addMethod(
  1236. smalltalk.method({
  1237. selector: "isImmutable",
  1238. category: 'testing',
  1239. fn: function (){
  1240. var self=this;
  1241. return smalltalk.withContext(function($ctx1) {
  1242. return true;
  1243. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})},
  1244. args: [],
  1245. source: "isImmutable\x0a\x09^ true",
  1246. messageSends: [],
  1247. referencedClasses: []
  1248. }),
  1249. smalltalk.Boolean);
  1250. smalltalk.addMethod(
  1251. smalltalk.method({
  1252. selector: "not",
  1253. category: 'controlling',
  1254. fn: function (){
  1255. var self=this;
  1256. return smalltalk.withContext(function($ctx1) {
  1257. var $1;
  1258. $1=_st(self).__eq(false);
  1259. return $1;
  1260. }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})},
  1261. args: [],
  1262. source: "not\x0a\x09^self = false",
  1263. messageSends: ["="],
  1264. referencedClasses: []
  1265. }),
  1266. smalltalk.Boolean);
  1267. smalltalk.addMethod(
  1268. smalltalk.method({
  1269. selector: "or:",
  1270. category: 'controlling',
  1271. fn: function (aBlock){
  1272. var self=this;
  1273. return smalltalk.withContext(function($ctx1) {
  1274. var $2,$1;
  1275. $2=_st(self).__eq(true);
  1276. $1=_st($2)._ifTrue_ifFalse_((function(){
  1277. return smalltalk.withContext(function($ctx2) {
  1278. return true;
  1279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1280. return $1;
  1281. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})},
  1282. args: ["aBlock"],
  1283. source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock",
  1284. messageSends: ["ifTrue:ifFalse:", "="],
  1285. referencedClasses: []
  1286. }),
  1287. smalltalk.Boolean);
  1288. smalltalk.addMethod(
  1289. smalltalk.method({
  1290. selector: "printOn:",
  1291. category: 'printing',
  1292. fn: function (aStream){
  1293. var self=this;
  1294. return smalltalk.withContext(function($ctx1) {
  1295. _st(aStream)._nextPutAll_(_st(self)._asString());
  1296. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})},
  1297. args: ["aStream"],
  1298. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  1299. messageSends: ["nextPutAll:", "asString"],
  1300. referencedClasses: []
  1301. }),
  1302. smalltalk.Boolean);
  1303. smalltalk.addMethod(
  1304. smalltalk.method({
  1305. selector: "shallowCopy",
  1306. category: 'copying',
  1307. fn: function (){
  1308. var self=this;
  1309. return smalltalk.withContext(function($ctx1) {
  1310. var $1;
  1311. $1=self;
  1312. return $1;
  1313. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})},
  1314. args: [],
  1315. source: "shallowCopy\x0a\x09^self",
  1316. messageSends: [],
  1317. referencedClasses: []
  1318. }),
  1319. smalltalk.Boolean);
  1320. smalltalk.addMethod(
  1321. smalltalk.method({
  1322. selector: "|",
  1323. category: 'controlling',
  1324. fn: function (aBoolean){
  1325. var self=this;
  1326. return smalltalk.withContext(function($ctx1) {
  1327. if(self == true) {
  1328. return true;
  1329. } else {
  1330. return aBoolean;
  1331. }
  1332. ;
  1333. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1334. args: ["aBoolean"],
  1335. 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>",
  1336. messageSends: [],
  1337. referencedClasses: []
  1338. }),
  1339. smalltalk.Boolean);
  1340. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1341. smalltalk.Date.comment="The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects."
  1342. smalltalk.addMethod(
  1343. smalltalk.method({
  1344. selector: "+",
  1345. category: 'arithmetic',
  1346. fn: function (aDate){
  1347. var self=this;
  1348. return smalltalk.withContext(function($ctx1) {
  1349. return self + aDate;
  1350. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})},
  1351. args: ["aDate"],
  1352. source: "+ aDate\x0a\x09<return self + aDate>",
  1353. messageSends: [],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.Date);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "-",
  1360. category: 'arithmetic',
  1361. fn: function (aDate){
  1362. var self=this;
  1363. return smalltalk.withContext(function($ctx1) {
  1364. return self - aDate;
  1365. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})},
  1366. args: ["aDate"],
  1367. source: "- aDate\x0a\x09<return self - aDate>",
  1368. messageSends: [],
  1369. referencedClasses: []
  1370. }),
  1371. smalltalk.Date);
  1372. smalltalk.addMethod(
  1373. smalltalk.method({
  1374. selector: "<",
  1375. category: 'comparing',
  1376. fn: function (aDate){
  1377. var self=this;
  1378. return smalltalk.withContext(function($ctx1) {
  1379. return self < aDate;
  1380. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})},
  1381. args: ["aDate"],
  1382. source: "< aDate\x0a\x09<return self < aDate>",
  1383. messageSends: [],
  1384. referencedClasses: []
  1385. }),
  1386. smalltalk.Date);
  1387. smalltalk.addMethod(
  1388. smalltalk.method({
  1389. selector: "<=",
  1390. category: 'comparing',
  1391. fn: function (aDate){
  1392. var self=this;
  1393. return smalltalk.withContext(function($ctx1) {
  1394. return self <= aDate;
  1395. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})},
  1396. args: ["aDate"],
  1397. source: "<= aDate\x0a\x09<return self <= aDate>",
  1398. messageSends: [],
  1399. referencedClasses: []
  1400. }),
  1401. smalltalk.Date);
  1402. smalltalk.addMethod(
  1403. smalltalk.method({
  1404. selector: ">",
  1405. category: 'comparing',
  1406. fn: function (aDate){
  1407. var self=this;
  1408. return smalltalk.withContext(function($ctx1) {
  1409. return self > aDate;
  1410. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})},
  1411. args: ["aDate"],
  1412. source: "> aDate\x0a\x09<return self >> aDate>",
  1413. messageSends: [],
  1414. referencedClasses: []
  1415. }),
  1416. smalltalk.Date);
  1417. smalltalk.addMethod(
  1418. smalltalk.method({
  1419. selector: ">=",
  1420. category: 'comparing',
  1421. fn: function (aDate){
  1422. var self=this;
  1423. return smalltalk.withContext(function($ctx1) {
  1424. return self >= aDate;
  1425. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})},
  1426. args: ["aDate"],
  1427. source: ">= aDate\x0a\x09<return self >>= aDate>",
  1428. messageSends: [],
  1429. referencedClasses: []
  1430. }),
  1431. smalltalk.Date);
  1432. smalltalk.addMethod(
  1433. smalltalk.method({
  1434. selector: "asDateString",
  1435. category: 'converting',
  1436. fn: function (){
  1437. var self=this;
  1438. return smalltalk.withContext(function($ctx1) {
  1439. return self.toDateString();
  1440. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})},
  1441. args: [],
  1442. source: "asDateString\x0a\x09<return self.toDateString()>",
  1443. messageSends: [],
  1444. referencedClasses: []
  1445. }),
  1446. smalltalk.Date);
  1447. smalltalk.addMethod(
  1448. smalltalk.method({
  1449. selector: "asLocaleString",
  1450. category: 'converting',
  1451. fn: function (){
  1452. var self=this;
  1453. return smalltalk.withContext(function($ctx1) {
  1454. return self.toLocaleString();
  1455. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})},
  1456. args: [],
  1457. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  1458. messageSends: [],
  1459. referencedClasses: []
  1460. }),
  1461. smalltalk.Date);
  1462. smalltalk.addMethod(
  1463. smalltalk.method({
  1464. selector: "asMilliseconds",
  1465. category: 'converting',
  1466. fn: function (){
  1467. var self=this;
  1468. return smalltalk.withContext(function($ctx1) {
  1469. var $1;
  1470. $1=_st(self)._time();
  1471. return $1;
  1472. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})},
  1473. args: [],
  1474. source: "asMilliseconds\x0a\x09^self time",
  1475. messageSends: ["time"],
  1476. referencedClasses: []
  1477. }),
  1478. smalltalk.Date);
  1479. smalltalk.addMethod(
  1480. smalltalk.method({
  1481. selector: "asNumber",
  1482. category: 'converting',
  1483. fn: function (){
  1484. var self=this;
  1485. return smalltalk.withContext(function($ctx1) {
  1486. var $1;
  1487. $1=_st(self)._asMilliseconds();
  1488. return $1;
  1489. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})},
  1490. args: [],
  1491. source: "asNumber\x0a\x09^self asMilliseconds",
  1492. messageSends: ["asMilliseconds"],
  1493. referencedClasses: []
  1494. }),
  1495. smalltalk.Date);
  1496. smalltalk.addMethod(
  1497. smalltalk.method({
  1498. selector: "asString",
  1499. category: 'converting',
  1500. fn: function (){
  1501. var self=this;
  1502. return smalltalk.withContext(function($ctx1) {
  1503. return self.toString();
  1504. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})},
  1505. args: [],
  1506. source: "asString\x0a\x09<return self.toString()>",
  1507. messageSends: [],
  1508. referencedClasses: []
  1509. }),
  1510. smalltalk.Date);
  1511. smalltalk.addMethod(
  1512. smalltalk.method({
  1513. selector: "asTimeString",
  1514. category: 'converting',
  1515. fn: function (){
  1516. var self=this;
  1517. return smalltalk.withContext(function($ctx1) {
  1518. return self.toTimeString();
  1519. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})},
  1520. args: [],
  1521. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  1522. messageSends: [],
  1523. referencedClasses: []
  1524. }),
  1525. smalltalk.Date);
  1526. smalltalk.addMethod(
  1527. smalltalk.method({
  1528. selector: "day",
  1529. category: 'accessing',
  1530. fn: function (){
  1531. var self=this;
  1532. return smalltalk.withContext(function($ctx1) {
  1533. var $1;
  1534. $1=_st(self)._dayOfWeek();
  1535. return $1;
  1536. }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})},
  1537. args: [],
  1538. source: "day\x0a\x09^self dayOfWeek",
  1539. messageSends: ["dayOfWeek"],
  1540. referencedClasses: []
  1541. }),
  1542. smalltalk.Date);
  1543. smalltalk.addMethod(
  1544. smalltalk.method({
  1545. selector: "day:",
  1546. category: 'accessing',
  1547. fn: function (aNumber){
  1548. var self=this;
  1549. return smalltalk.withContext(function($ctx1) {
  1550. _st(self)._dayOfWeek_(aNumber);
  1551. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})},
  1552. args: ["aNumber"],
  1553. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  1554. messageSends: ["dayOfWeek:"],
  1555. referencedClasses: []
  1556. }),
  1557. smalltalk.Date);
  1558. smalltalk.addMethod(
  1559. smalltalk.method({
  1560. selector: "dayOfMonth",
  1561. category: 'accessing',
  1562. fn: function (){
  1563. var self=this;
  1564. return smalltalk.withContext(function($ctx1) {
  1565. return self.getDate();
  1566. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})},
  1567. args: [],
  1568. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  1569. messageSends: [],
  1570. referencedClasses: []
  1571. }),
  1572. smalltalk.Date);
  1573. smalltalk.addMethod(
  1574. smalltalk.method({
  1575. selector: "dayOfMonth:",
  1576. category: 'accessing',
  1577. fn: function (aNumber){
  1578. var self=this;
  1579. return smalltalk.withContext(function($ctx1) {
  1580. self.setDate(aNumber);
  1581. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})},
  1582. args: ["aNumber"],
  1583. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  1584. messageSends: [],
  1585. referencedClasses: []
  1586. }),
  1587. smalltalk.Date);
  1588. smalltalk.addMethod(
  1589. smalltalk.method({
  1590. selector: "dayOfWeek",
  1591. category: 'accessing',
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. return self.getDay() + 1;
  1596. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})},
  1597. args: [],
  1598. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  1599. messageSends: [],
  1600. referencedClasses: []
  1601. }),
  1602. smalltalk.Date);
  1603. smalltalk.addMethod(
  1604. smalltalk.method({
  1605. selector: "dayOfWeek:",
  1606. category: 'accessing',
  1607. fn: function (aNumber){
  1608. var self=this;
  1609. return smalltalk.withContext(function($ctx1) {
  1610. return self.setDay(aNumber - 1);
  1611. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})},
  1612. args: ["aNumber"],
  1613. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  1614. messageSends: [],
  1615. referencedClasses: []
  1616. }),
  1617. smalltalk.Date);
  1618. smalltalk.addMethod(
  1619. smalltalk.method({
  1620. selector: "hours",
  1621. category: 'accessing',
  1622. fn: function (){
  1623. var self=this;
  1624. return smalltalk.withContext(function($ctx1) {
  1625. return self.getHours();
  1626. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})},
  1627. args: [],
  1628. source: "hours\x0a\x09<return self.getHours()>",
  1629. messageSends: [],
  1630. referencedClasses: []
  1631. }),
  1632. smalltalk.Date);
  1633. smalltalk.addMethod(
  1634. smalltalk.method({
  1635. selector: "hours:",
  1636. category: 'accessing',
  1637. fn: function (aNumber){
  1638. var self=this;
  1639. return smalltalk.withContext(function($ctx1) {
  1640. self.setHours(aNumber);
  1641. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})},
  1642. args: ["aNumber"],
  1643. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  1644. messageSends: [],
  1645. referencedClasses: []
  1646. }),
  1647. smalltalk.Date);
  1648. smalltalk.addMethod(
  1649. smalltalk.method({
  1650. selector: "milliseconds",
  1651. category: 'accessing',
  1652. fn: function (){
  1653. var self=this;
  1654. return smalltalk.withContext(function($ctx1) {
  1655. return self.getMilliseconds();
  1656. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})},
  1657. args: [],
  1658. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  1659. messageSends: [],
  1660. referencedClasses: []
  1661. }),
  1662. smalltalk.Date);
  1663. smalltalk.addMethod(
  1664. smalltalk.method({
  1665. selector: "milliseconds:",
  1666. category: 'accessing',
  1667. fn: function (aNumber){
  1668. var self=this;
  1669. return smalltalk.withContext(function($ctx1) {
  1670. self.setMilliseconds(aNumber);
  1671. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})},
  1672. args: ["aNumber"],
  1673. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  1674. messageSends: [],
  1675. referencedClasses: []
  1676. }),
  1677. smalltalk.Date);
  1678. smalltalk.addMethod(
  1679. smalltalk.method({
  1680. selector: "minutes",
  1681. category: 'accessing',
  1682. fn: function (){
  1683. var self=this;
  1684. return smalltalk.withContext(function($ctx1) {
  1685. return self.getMinutes();
  1686. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})},
  1687. args: [],
  1688. source: "minutes\x0a\x09<return self.getMinutes()>",
  1689. messageSends: [],
  1690. referencedClasses: []
  1691. }),
  1692. smalltalk.Date);
  1693. smalltalk.addMethod(
  1694. smalltalk.method({
  1695. selector: "minutes:",
  1696. category: 'accessing',
  1697. fn: function (aNumber){
  1698. var self=this;
  1699. return smalltalk.withContext(function($ctx1) {
  1700. self.setMinutes(aNumber);
  1701. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})},
  1702. args: ["aNumber"],
  1703. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  1704. messageSends: [],
  1705. referencedClasses: []
  1706. }),
  1707. smalltalk.Date);
  1708. smalltalk.addMethod(
  1709. smalltalk.method({
  1710. selector: "month",
  1711. category: 'accessing',
  1712. fn: function (){
  1713. var self=this;
  1714. return smalltalk.withContext(function($ctx1) {
  1715. return self.getMonth() + 1;
  1716. return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})},
  1717. args: [],
  1718. source: "month\x0a\x09<return self.getMonth() + 1>",
  1719. messageSends: [],
  1720. referencedClasses: []
  1721. }),
  1722. smalltalk.Date);
  1723. smalltalk.addMethod(
  1724. smalltalk.method({
  1725. selector: "month:",
  1726. category: 'accessing',
  1727. fn: function (aNumber){
  1728. var self=this;
  1729. return smalltalk.withContext(function($ctx1) {
  1730. self.setMonth(aNumber - 1);
  1731. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})},
  1732. args: ["aNumber"],
  1733. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  1734. messageSends: [],
  1735. referencedClasses: []
  1736. }),
  1737. smalltalk.Date);
  1738. smalltalk.addMethod(
  1739. smalltalk.method({
  1740. selector: "printOn:",
  1741. category: 'printing',
  1742. fn: function (aStream){
  1743. var self=this;
  1744. return smalltalk.withContext(function($ctx1) {
  1745. _st(aStream)._nextPutAll_(_st(self)._asString());
  1746. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})},
  1747. args: ["aStream"],
  1748. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  1749. messageSends: ["nextPutAll:", "asString"],
  1750. referencedClasses: []
  1751. }),
  1752. smalltalk.Date);
  1753. smalltalk.addMethod(
  1754. smalltalk.method({
  1755. selector: "seconds",
  1756. category: 'accessing',
  1757. fn: function (){
  1758. var self=this;
  1759. return smalltalk.withContext(function($ctx1) {
  1760. return self.getSeconds();
  1761. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})},
  1762. args: [],
  1763. source: "seconds\x0a\x09<return self.getSeconds()>",
  1764. messageSends: [],
  1765. referencedClasses: []
  1766. }),
  1767. smalltalk.Date);
  1768. smalltalk.addMethod(
  1769. smalltalk.method({
  1770. selector: "seconds:",
  1771. category: 'accessing',
  1772. fn: function (aNumber){
  1773. var self=this;
  1774. return smalltalk.withContext(function($ctx1) {
  1775. self.setSeconds(aNumber);
  1776. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})},
  1777. args: ["aNumber"],
  1778. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  1779. messageSends: [],
  1780. referencedClasses: []
  1781. }),
  1782. smalltalk.Date);
  1783. smalltalk.addMethod(
  1784. smalltalk.method({
  1785. selector: "time",
  1786. category: 'accessing',
  1787. fn: function (){
  1788. var self=this;
  1789. return smalltalk.withContext(function($ctx1) {
  1790. return self.getTime();
  1791. return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})},
  1792. args: [],
  1793. source: "time\x0a\x09<return self.getTime()>",
  1794. messageSends: [],
  1795. referencedClasses: []
  1796. }),
  1797. smalltalk.Date);
  1798. smalltalk.addMethod(
  1799. smalltalk.method({
  1800. selector: "time:",
  1801. category: 'accessing',
  1802. fn: function (aNumber){
  1803. var self=this;
  1804. return smalltalk.withContext(function($ctx1) {
  1805. self.setTime(aNumber);
  1806. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})},
  1807. args: ["aNumber"],
  1808. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  1809. messageSends: [],
  1810. referencedClasses: []
  1811. }),
  1812. smalltalk.Date);
  1813. smalltalk.addMethod(
  1814. smalltalk.method({
  1815. selector: "year",
  1816. category: 'accessing',
  1817. fn: function (){
  1818. var self=this;
  1819. return smalltalk.withContext(function($ctx1) {
  1820. return self.getFullYear();
  1821. return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})},
  1822. args: [],
  1823. source: "year\x0a\x09<return self.getFullYear()>",
  1824. messageSends: [],
  1825. referencedClasses: []
  1826. }),
  1827. smalltalk.Date);
  1828. smalltalk.addMethod(
  1829. smalltalk.method({
  1830. selector: "year:",
  1831. category: 'accessing',
  1832. fn: function (aNumber){
  1833. var self=this;
  1834. return smalltalk.withContext(function($ctx1) {
  1835. self.setFullYear(aNumber);
  1836. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})},
  1837. args: ["aNumber"],
  1838. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  1839. messageSends: [],
  1840. referencedClasses: []
  1841. }),
  1842. smalltalk.Date);
  1843. smalltalk.addMethod(
  1844. smalltalk.method({
  1845. selector: "fromMilliseconds:",
  1846. category: 'instance creation',
  1847. fn: function (aNumber){
  1848. var self=this;
  1849. return smalltalk.withContext(function($ctx1) {
  1850. var $1;
  1851. $1=_st(self)._new_(aNumber);
  1852. return $1;
  1853. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  1854. args: ["aNumber"],
  1855. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  1856. messageSends: ["new:"],
  1857. referencedClasses: []
  1858. }),
  1859. smalltalk.Date.klass);
  1860. smalltalk.addMethod(
  1861. smalltalk.method({
  1862. selector: "fromSeconds:",
  1863. category: 'instance creation',
  1864. fn: function (aNumber){
  1865. var self=this;
  1866. return smalltalk.withContext(function($ctx1) {
  1867. var $1;
  1868. $1=_st(self)._fromMilliseconds_(_st(aNumber).__star((1000)));
  1869. return $1;
  1870. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  1871. args: ["aNumber"],
  1872. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  1873. messageSends: ["fromMilliseconds:", "*"],
  1874. referencedClasses: []
  1875. }),
  1876. smalltalk.Date.klass);
  1877. smalltalk.addMethod(
  1878. smalltalk.method({
  1879. selector: "fromString:",
  1880. category: 'instance creation',
  1881. fn: function (aString){
  1882. var self=this;
  1883. return smalltalk.withContext(function($ctx1) {
  1884. var $1;
  1885. $1=_st(self)._new_(aString);
  1886. return $1;
  1887. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})},
  1888. args: ["aString"],
  1889. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  1890. messageSends: ["new:"],
  1891. referencedClasses: []
  1892. }),
  1893. smalltalk.Date.klass);
  1894. smalltalk.addMethod(
  1895. smalltalk.method({
  1896. selector: "millisecondsToRun:",
  1897. category: 'instance creation',
  1898. fn: function (aBlock){
  1899. var self=this;
  1900. var t;
  1901. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  1902. return smalltalk.withContext(function($ctx1) {
  1903. var $1;
  1904. t=_st($Date())._now();
  1905. _st(aBlock)._value();
  1906. $1=_st(_st($Date())._now()).__minus(t);
  1907. return $1;
  1908. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})},
  1909. args: ["aBlock"],
  1910. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  1911. messageSends: ["now", "value", "-"],
  1912. referencedClasses: ["Date"]
  1913. }),
  1914. smalltalk.Date.klass);
  1915. smalltalk.addMethod(
  1916. smalltalk.method({
  1917. selector: "new:",
  1918. category: 'instance creation',
  1919. fn: function (anObject){
  1920. var self=this;
  1921. return smalltalk.withContext(function($ctx1) {
  1922. return new Date(anObject);
  1923. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})},
  1924. args: ["anObject"],
  1925. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  1926. messageSends: [],
  1927. referencedClasses: []
  1928. }),
  1929. smalltalk.Date.klass);
  1930. smalltalk.addMethod(
  1931. smalltalk.method({
  1932. selector: "now",
  1933. category: 'instance creation',
  1934. fn: function (){
  1935. var self=this;
  1936. return smalltalk.withContext(function($ctx1) {
  1937. var $1;
  1938. $1=_st(self)._today();
  1939. return $1;
  1940. }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})},
  1941. args: [],
  1942. source: "now\x0a\x09^self today",
  1943. messageSends: ["today"],
  1944. referencedClasses: []
  1945. }),
  1946. smalltalk.Date.klass);
  1947. smalltalk.addMethod(
  1948. smalltalk.method({
  1949. selector: "today",
  1950. category: 'instance creation',
  1951. fn: function (){
  1952. var self=this;
  1953. return smalltalk.withContext(function($ctx1) {
  1954. var $1;
  1955. $1=_st(self)._new();
  1956. return $1;
  1957. }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})},
  1958. args: [],
  1959. source: "today\x0a\x09^self new",
  1960. messageSends: ["new"],
  1961. referencedClasses: []
  1962. }),
  1963. smalltalk.Date.klass);
  1964. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  1965. smalltalk.JSObjectProxy.comment="JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.\x0aJSOjbectProxy makes intensive use of `#doesNotUnderstand:`.\x0a\x0a## Examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aSmalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`."
  1966. smalltalk.addMethod(
  1967. smalltalk.method({
  1968. selector: "addObjectVariablesTo:",
  1969. category: 'proxy',
  1970. fn: function (aDictionary){
  1971. var self=this;
  1972. return smalltalk.withContext(function($ctx1) {
  1973. for(var i in self['@jsObject']) {
  1974. aDictionary._at_put_(i, self['@jsObject'][i]);
  1975. }
  1976. ;
  1977. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
  1978. args: ["aDictionary"],
  1979. 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>",
  1980. messageSends: [],
  1981. referencedClasses: []
  1982. }),
  1983. smalltalk.JSObjectProxy);
  1984. smalltalk.addMethod(
  1985. smalltalk.method({
  1986. selector: "at:",
  1987. category: 'accessing',
  1988. fn: function (aString){
  1989. var self=this;
  1990. return smalltalk.withContext(function($ctx1) {
  1991. return self['@jsObject'][aString];
  1992. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
  1993. args: ["aString"],
  1994. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  1995. messageSends: [],
  1996. referencedClasses: []
  1997. }),
  1998. smalltalk.JSObjectProxy);
  1999. smalltalk.addMethod(
  2000. smalltalk.method({
  2001. selector: "at:ifAbsent:",
  2002. category: 'accessing',
  2003. fn: function (aString,aBlock){
  2004. var self=this;
  2005. return smalltalk.withContext(function($ctx1) {
  2006. var obj = self['@jsObject'];
  2007. return aString in obj ? obj[aString] : aBlock();
  2008. ;
  2009. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  2010. args: ["aString", "aBlock"],
  2011. 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>",
  2012. messageSends: [],
  2013. referencedClasses: []
  2014. }),
  2015. smalltalk.JSObjectProxy);
  2016. smalltalk.addMethod(
  2017. smalltalk.method({
  2018. selector: "at:ifPresent:",
  2019. category: 'accessing',
  2020. fn: function (aString,aBlock){
  2021. var self=this;
  2022. return smalltalk.withContext(function($ctx1) {
  2023. var obj = self['@jsObject'];
  2024. return aString in obj ? aBlock(obj[aString]) : nil;
  2025. ;
  2026. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  2027. args: ["aString", "aBlock"],
  2028. 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>",
  2029. messageSends: [],
  2030. referencedClasses: []
  2031. }),
  2032. smalltalk.JSObjectProxy);
  2033. smalltalk.addMethod(
  2034. smalltalk.method({
  2035. selector: "at:ifPresent:ifAbsent:",
  2036. category: 'accessing',
  2037. fn: function (aString,aBlock,anotherBlock){
  2038. var self=this;
  2039. return smalltalk.withContext(function($ctx1) {
  2040. var obj = self['@jsObject'];
  2041. return aString in obj ? aBlock(obj[aString]) : anotherBlock();
  2042. ;
  2043. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})},
  2044. args: ["aString", "aBlock", "anotherBlock"],
  2045. 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>",
  2046. messageSends: [],
  2047. referencedClasses: []
  2048. }),
  2049. smalltalk.JSObjectProxy);
  2050. smalltalk.addMethod(
  2051. smalltalk.method({
  2052. selector: "at:put:",
  2053. category: 'accessing',
  2054. fn: function (aString,anObject){
  2055. var self=this;
  2056. return smalltalk.withContext(function($ctx1) {
  2057. self['@jsObject'][aString] = anObject;
  2058. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
  2059. args: ["aString", "anObject"],
  2060. source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
  2061. messageSends: [],
  2062. referencedClasses: []
  2063. }),
  2064. smalltalk.JSObjectProxy);
  2065. smalltalk.addMethod(
  2066. smalltalk.method({
  2067. selector: "doesNotUnderstand:",
  2068. category: 'proxy',
  2069. fn: function (aMessage){
  2070. var self=this;
  2071. return smalltalk.withContext(function($ctx1) {
  2072. var $2,$1;
  2073. $2=_st(self)._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  2074. if(($receiver = $2) == nil || $receiver == undefined){
  2075. $1=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  2076. } else {
  2077. var jsSelector;
  2078. jsSelector=$receiver;
  2079. $1=_st(self)._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  2080. };
  2081. return $1;
  2082. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
  2083. args: ["aMessage"],
  2084. 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 ]",
  2085. messageSends: ["ifNil:ifNotNil:", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments", "lookupProperty:", "asJavaScriptSelector", "selector"],
  2086. referencedClasses: []
  2087. }),
  2088. smalltalk.JSObjectProxy);
  2089. smalltalk.addMethod(
  2090. smalltalk.method({
  2091. selector: "forwardMessage:withArguments:",
  2092. category: 'proxy',
  2093. fn: function (aString,anArray){
  2094. var self=this;
  2095. return smalltalk.withContext(function($ctx1) {
  2096. return smalltalk.send(self._jsObject(), aString, anArray);
  2097. ;
  2098. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
  2099. args: ["aString", "anArray"],
  2100. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  2101. messageSends: [],
  2102. referencedClasses: []
  2103. }),
  2104. smalltalk.JSObjectProxy);
  2105. smalltalk.addMethod(
  2106. smalltalk.method({
  2107. selector: "inspectOn:",
  2108. category: 'proxy',
  2109. fn: function (anInspector){
  2110. var self=this;
  2111. var variables;
  2112. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2113. return smalltalk.withContext(function($ctx1) {
  2114. variables=_st($Dictionary())._new();
  2115. _st(variables)._at_put_("#self",_st(self)._jsObject());
  2116. _st(anInspector)._setLabel_(_st(self)._printString());
  2117. _st(self)._addObjectVariablesTo_(variables);
  2118. _st(anInspector)._setVariables_(variables);
  2119. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
  2120. args: ["anInspector"],
  2121. 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",
  2122. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  2123. referencedClasses: ["Dictionary"]
  2124. }),
  2125. smalltalk.JSObjectProxy);
  2126. smalltalk.addMethod(
  2127. smalltalk.method({
  2128. selector: "jsObject",
  2129. category: 'accessing',
  2130. fn: function (){
  2131. var self=this;
  2132. return smalltalk.withContext(function($ctx1) {
  2133. var $1;
  2134. $1=self["@jsObject"];
  2135. return $1;
  2136. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
  2137. args: [],
  2138. source: "jsObject\x0a\x09^jsObject",
  2139. messageSends: [],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.JSObjectProxy);
  2143. smalltalk.addMethod(
  2144. smalltalk.method({
  2145. selector: "jsObject:",
  2146. category: 'accessing',
  2147. fn: function (aJSObject){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) {
  2150. self["@jsObject"]=aJSObject;
  2151. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
  2152. args: ["aJSObject"],
  2153. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  2154. messageSends: [],
  2155. referencedClasses: []
  2156. }),
  2157. smalltalk.JSObjectProxy);
  2158. smalltalk.addMethod(
  2159. smalltalk.method({
  2160. selector: "keysAndValuesDo:",
  2161. category: 'enumerating',
  2162. fn: function (aBlock){
  2163. var self=this;
  2164. return smalltalk.withContext(function($ctx1) {
  2165. var o = self['@jsObject'];
  2166. for(var i in o) {
  2167. aBlock(i, o[i]);
  2168. }
  2169. ;
  2170. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})},
  2171. args: ["aBlock"],
  2172. 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>",
  2173. messageSends: [],
  2174. referencedClasses: []
  2175. }),
  2176. smalltalk.JSObjectProxy);
  2177. smalltalk.addMethod(
  2178. smalltalk.method({
  2179. selector: "lookupProperty:",
  2180. category: 'accessing',
  2181. fn: function (aString){
  2182. var self=this;
  2183. return smalltalk.withContext(function($ctx1) {
  2184. return aString in self._jsObject() ? aString : nil;
  2185. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
  2186. args: ["aString"],
  2187. 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>",
  2188. messageSends: [],
  2189. referencedClasses: []
  2190. }),
  2191. smalltalk.JSObjectProxy);
  2192. smalltalk.addMethod(
  2193. smalltalk.method({
  2194. selector: "printOn:",
  2195. category: 'printing',
  2196. fn: function (aStream){
  2197. var self=this;
  2198. return smalltalk.withContext(function($ctx1) {
  2199. _st(aStream)._nextPutAll_(_st(_st(self)._jsObject())._toString());
  2200. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
  2201. args: ["aStream"],
  2202. source: "printOn: aStream\x0a\x09aStream nextPutAll: self jsObject toString",
  2203. messageSends: ["nextPutAll:", "toString", "jsObject"],
  2204. referencedClasses: []
  2205. }),
  2206. smalltalk.JSObjectProxy);
  2207. smalltalk.addMethod(
  2208. smalltalk.method({
  2209. selector: "value",
  2210. category: 'accessing',
  2211. fn: function (){
  2212. var self=this;
  2213. return smalltalk.withContext(function($ctx1) {
  2214. var $1;
  2215. $1=_st(self)._at_ifAbsent_("value",(function(){
  2216. return smalltalk.withContext(function($ctx2) {
  2217. return smalltalk.Object.fn.prototype._value.apply(_st(self), []);
  2218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2219. return $1;
  2220. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
  2221. args: [],
  2222. 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 ]",
  2223. messageSends: ["at:ifAbsent:", "value"],
  2224. referencedClasses: []
  2225. }),
  2226. smalltalk.JSObjectProxy);
  2227. smalltalk.addMethod(
  2228. smalltalk.method({
  2229. selector: "on:",
  2230. category: 'instance creation',
  2231. fn: function (aJSObject){
  2232. var self=this;
  2233. return smalltalk.withContext(function($ctx1) {
  2234. var $2,$3,$1;
  2235. $2=_st(self)._new();
  2236. _st($2)._jsObject_(aJSObject);
  2237. $3=_st($2)._yourself();
  2238. $1=$3;
  2239. return $1;
  2240. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
  2241. args: ["aJSObject"],
  2242. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  2243. messageSends: ["jsObject:", "new", "yourself"],
  2244. referencedClasses: []
  2245. }),
  2246. smalltalk.JSObjectProxy.klass);
  2247. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  2248. smalltalk.Number.comment="Number holds the most general methods for dealing with numbers.\x0aNumber is directly mapped to JavaScript Number.\x0a\x0aMost arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript.\x0a\x0a##Enumerating\x0aA Number can be used to evaluate a Block a fixed number of times:\x0a\x0a\x095 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].\x0a\x09\x0a\x091 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].\x0a\x09\x0a\x091 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr]."
  2249. smalltalk.addMethod(
  2250. smalltalk.method({
  2251. selector: "&",
  2252. category: 'converting',
  2253. fn: function (aNumber){
  2254. var self=this;
  2255. return smalltalk.withContext(function($ctx1) {
  2256. return self & aNumber;
  2257. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})},
  2258. args: ["aNumber"],
  2259. source: "& aNumber\x0a\x09<return self & aNumber>",
  2260. messageSends: [],
  2261. referencedClasses: []
  2262. }),
  2263. smalltalk.Number);
  2264. smalltalk.addMethod(
  2265. smalltalk.method({
  2266. selector: "*",
  2267. category: 'arithmetic',
  2268. fn: function (aNumber){
  2269. var self=this;
  2270. return smalltalk.withContext(function($ctx1) {
  2271. return self * aNumber;
  2272. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})},
  2273. args: ["aNumber"],
  2274. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  2275. messageSends: [],
  2276. referencedClasses: []
  2277. }),
  2278. smalltalk.Number);
  2279. smalltalk.addMethod(
  2280. smalltalk.method({
  2281. selector: "+",
  2282. category: 'arithmetic',
  2283. fn: function (aNumber){
  2284. var self=this;
  2285. return smalltalk.withContext(function($ctx1) {
  2286. return self + aNumber;
  2287. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})},
  2288. args: ["aNumber"],
  2289. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  2290. messageSends: [],
  2291. referencedClasses: []
  2292. }),
  2293. smalltalk.Number);
  2294. smalltalk.addMethod(
  2295. smalltalk.method({
  2296. selector: "-",
  2297. category: 'arithmetic',
  2298. fn: function (aNumber){
  2299. var self=this;
  2300. return smalltalk.withContext(function($ctx1) {
  2301. return self - aNumber;
  2302. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})},
  2303. args: ["aNumber"],
  2304. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  2305. messageSends: [],
  2306. referencedClasses: []
  2307. }),
  2308. smalltalk.Number);
  2309. smalltalk.addMethod(
  2310. smalltalk.method({
  2311. selector: "/",
  2312. category: 'arithmetic',
  2313. fn: function (aNumber){
  2314. var self=this;
  2315. return smalltalk.withContext(function($ctx1) {
  2316. return self / aNumber;
  2317. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})},
  2318. args: ["aNumber"],
  2319. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  2320. messageSends: [],
  2321. referencedClasses: []
  2322. }),
  2323. smalltalk.Number);
  2324. smalltalk.addMethod(
  2325. smalltalk.method({
  2326. selector: "<",
  2327. category: 'comparing',
  2328. fn: function (aNumber){
  2329. var self=this;
  2330. return smalltalk.withContext(function($ctx1) {
  2331. return self < aNumber;
  2332. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})},
  2333. args: ["aNumber"],
  2334. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  2335. messageSends: [],
  2336. referencedClasses: []
  2337. }),
  2338. smalltalk.Number);
  2339. smalltalk.addMethod(
  2340. smalltalk.method({
  2341. selector: "<=",
  2342. category: 'comparing',
  2343. fn: function (aNumber){
  2344. var self=this;
  2345. return smalltalk.withContext(function($ctx1) {
  2346. return self <= aNumber;
  2347. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})},
  2348. args: ["aNumber"],
  2349. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  2350. messageSends: [],
  2351. referencedClasses: []
  2352. }),
  2353. smalltalk.Number);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "=",
  2357. category: 'comparing',
  2358. fn: function (aNumber){
  2359. var self=this;
  2360. return smalltalk.withContext(function($ctx1) {
  2361. if(! aNumber._isNumber || ! aNumber._isNumber()) {
  2362. return false;
  2363. }
  2364. return Number(self) == aNumber
  2365. ;
  2366. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})},
  2367. args: ["aNumber"],
  2368. 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>",
  2369. messageSends: [],
  2370. referencedClasses: []
  2371. }),
  2372. smalltalk.Number);
  2373. smalltalk.addMethod(
  2374. smalltalk.method({
  2375. selector: ">",
  2376. category: 'comparing',
  2377. fn: function (aNumber){
  2378. var self=this;
  2379. return smalltalk.withContext(function($ctx1) {
  2380. return self > aNumber;
  2381. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})},
  2382. args: ["aNumber"],
  2383. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  2384. messageSends: [],
  2385. referencedClasses: []
  2386. }),
  2387. smalltalk.Number);
  2388. smalltalk.addMethod(
  2389. smalltalk.method({
  2390. selector: ">=",
  2391. category: 'comparing',
  2392. fn: function (aNumber){
  2393. var self=this;
  2394. return smalltalk.withContext(function($ctx1) {
  2395. return self >= aNumber;
  2396. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})},
  2397. args: ["aNumber"],
  2398. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  2399. messageSends: [],
  2400. referencedClasses: []
  2401. }),
  2402. smalltalk.Number);
  2403. smalltalk.addMethod(
  2404. smalltalk.method({
  2405. selector: "@",
  2406. category: 'converting',
  2407. fn: function (aNumber){
  2408. var self=this;
  2409. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2410. return smalltalk.withContext(function($ctx1) {
  2411. var $1;
  2412. $1=_st($Point())._x_y_(self,aNumber);
  2413. return $1;
  2414. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})},
  2415. args: ["aNumber"],
  2416. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  2417. messageSends: ["x:y:"],
  2418. referencedClasses: ["Point"]
  2419. }),
  2420. smalltalk.Number);
  2421. smalltalk.addMethod(
  2422. smalltalk.method({
  2423. selector: "IsImmutable",
  2424. category: 'testing',
  2425. fn: function (){
  2426. var self=this;
  2427. return smalltalk.withContext(function($ctx1) {
  2428. return true;
  2429. }, function($ctx1) {$ctx1.fill(self,"IsImmutable",{},smalltalk.Number)})},
  2430. args: [],
  2431. source: "IsImmutable\x0a\x09^ true",
  2432. messageSends: [],
  2433. referencedClasses: []
  2434. }),
  2435. smalltalk.Number);
  2436. smalltalk.addMethod(
  2437. smalltalk.method({
  2438. selector: "\x5c\x5c",
  2439. category: 'arithmetic',
  2440. fn: function (aNumber){
  2441. var self=this;
  2442. return smalltalk.withContext(function($ctx1) {
  2443. return self % aNumber;
  2444. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})},
  2445. args: ["aNumber"],
  2446. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  2447. messageSends: [],
  2448. referencedClasses: []
  2449. }),
  2450. smalltalk.Number);
  2451. smalltalk.addMethod(
  2452. smalltalk.method({
  2453. selector: "abs",
  2454. category: 'arithmetic',
  2455. fn: function (){
  2456. var self=this;
  2457. return smalltalk.withContext(function($ctx1) {
  2458. return Math.abs(self);;
  2459. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})},
  2460. args: [],
  2461. source: "abs\x0a\x09<return Math.abs(self);>",
  2462. messageSends: [],
  2463. referencedClasses: []
  2464. }),
  2465. smalltalk.Number);
  2466. smalltalk.addMethod(
  2467. smalltalk.method({
  2468. selector: "asJSON",
  2469. category: 'converting',
  2470. fn: function (){
  2471. var self=this;
  2472. return smalltalk.withContext(function($ctx1) {
  2473. var $1;
  2474. $1=self;
  2475. return $1;
  2476. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})},
  2477. args: [],
  2478. source: "asJSON\x0a\x09^self",
  2479. messageSends: [],
  2480. referencedClasses: []
  2481. }),
  2482. smalltalk.Number);
  2483. smalltalk.addMethod(
  2484. smalltalk.method({
  2485. selector: "asJavascript",
  2486. category: 'converting',
  2487. fn: function (){
  2488. var self=this;
  2489. return smalltalk.withContext(function($ctx1) {
  2490. var $1;
  2491. $1=_st(_st("(").__comma(_st(self)._printString())).__comma(")");
  2492. return $1;
  2493. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})},
  2494. args: [],
  2495. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  2496. messageSends: [",", "printString"],
  2497. referencedClasses: []
  2498. }),
  2499. smalltalk.Number);
  2500. smalltalk.addMethod(
  2501. smalltalk.method({
  2502. selector: "asPoint",
  2503. category: 'converting',
  2504. fn: function (){
  2505. var self=this;
  2506. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  2507. return smalltalk.withContext(function($ctx1) {
  2508. var $1;
  2509. $1=_st($Point())._x_y_(self,self);
  2510. return $1;
  2511. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})},
  2512. args: [],
  2513. source: "asPoint\x0a\x09^Point x: self y: self",
  2514. messageSends: ["x:y:"],
  2515. referencedClasses: ["Point"]
  2516. }),
  2517. smalltalk.Number);
  2518. smalltalk.addMethod(
  2519. smalltalk.method({
  2520. selector: "asString",
  2521. category: 'converting',
  2522. fn: function (){
  2523. var self=this;
  2524. return smalltalk.withContext(function($ctx1) {
  2525. return String(self) ;
  2526. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})},
  2527. args: [],
  2528. source: "asString\x0a\x09< return String(self) >",
  2529. messageSends: [],
  2530. referencedClasses: []
  2531. }),
  2532. smalltalk.Number);
  2533. smalltalk.addMethod(
  2534. smalltalk.method({
  2535. selector: "atRandom",
  2536. category: 'converting',
  2537. fn: function (){
  2538. var self=this;
  2539. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  2540. return smalltalk.withContext(function($ctx1) {
  2541. var $1;
  2542. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  2543. return $1;
  2544. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})},
  2545. args: [],
  2546. source: "atRandom\x0a\x09^(Random new next * self) truncated + 1",
  2547. messageSends: ["+", "truncated", "*", "next", "new"],
  2548. referencedClasses: ["Random"]
  2549. }),
  2550. smalltalk.Number);
  2551. smalltalk.addMethod(
  2552. smalltalk.method({
  2553. selector: "copy",
  2554. category: 'copying',
  2555. fn: function (){
  2556. var self=this;
  2557. return smalltalk.withContext(function($ctx1) {
  2558. var $1;
  2559. $1=self;
  2560. return $1;
  2561. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})},
  2562. args: [],
  2563. source: "copy\x0a\x09^self",
  2564. messageSends: [],
  2565. referencedClasses: []
  2566. }),
  2567. smalltalk.Number);
  2568. smalltalk.addMethod(
  2569. smalltalk.method({
  2570. selector: "deepCopy",
  2571. category: 'copying',
  2572. fn: function (){
  2573. var self=this;
  2574. return smalltalk.withContext(function($ctx1) {
  2575. var $1;
  2576. $1=_st(self)._copy();
  2577. return $1;
  2578. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})},
  2579. args: [],
  2580. source: "deepCopy\x0a\x09^self copy",
  2581. messageSends: ["copy"],
  2582. referencedClasses: []
  2583. }),
  2584. smalltalk.Number);
  2585. smalltalk.addMethod(
  2586. smalltalk.method({
  2587. selector: "even",
  2588. category: 'testing',
  2589. fn: function (){
  2590. var self=this;
  2591. return smalltalk.withContext(function($ctx1) {
  2592. var $1;
  2593. $1=_st((0)).__eq(_st(self).__backslash_backslash((2)));
  2594. return $1;
  2595. }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})},
  2596. args: [],
  2597. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  2598. messageSends: ["=", "\x5c\x5c"],
  2599. referencedClasses: []
  2600. }),
  2601. smalltalk.Number);
  2602. smalltalk.addMethod(
  2603. smalltalk.method({
  2604. selector: "identityHash",
  2605. category: 'accessing',
  2606. fn: function (){
  2607. var self=this;
  2608. return smalltalk.withContext(function($ctx1) {
  2609. var $1;
  2610. $1=_st(_st(self)._asString()).__comma("n");
  2611. return $1;
  2612. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})},
  2613. args: [],
  2614. source: "identityHash\x0a\x09^self asString, 'n'",
  2615. messageSends: [",", "asString"],
  2616. referencedClasses: []
  2617. }),
  2618. smalltalk.Number);
  2619. smalltalk.addMethod(
  2620. smalltalk.method({
  2621. selector: "isNumber",
  2622. category: 'testing',
  2623. fn: function (){
  2624. var self=this;
  2625. return smalltalk.withContext(function($ctx1) {
  2626. return true;
  2627. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})},
  2628. args: [],
  2629. source: "isNumber\x0a\x09^true",
  2630. messageSends: [],
  2631. referencedClasses: []
  2632. }),
  2633. smalltalk.Number);
  2634. smalltalk.addMethod(
  2635. smalltalk.method({
  2636. selector: "isZero",
  2637. category: 'testing',
  2638. fn: function (){
  2639. var self=this;
  2640. return smalltalk.withContext(function($ctx1) {
  2641. var $1;
  2642. $1=_st(self).__eq((0));
  2643. return $1;
  2644. }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})},
  2645. args: [],
  2646. source: "isZero\x0a\x09^self = 0",
  2647. messageSends: ["="],
  2648. referencedClasses: []
  2649. }),
  2650. smalltalk.Number);
  2651. smalltalk.addMethod(
  2652. smalltalk.method({
  2653. selector: "max:",
  2654. category: 'arithmetic',
  2655. fn: function (aNumber){
  2656. var self=this;
  2657. return smalltalk.withContext(function($ctx1) {
  2658. return Math.max(self, aNumber);;
  2659. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})},
  2660. args: ["aNumber"],
  2661. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  2662. messageSends: [],
  2663. referencedClasses: []
  2664. }),
  2665. smalltalk.Number);
  2666. smalltalk.addMethod(
  2667. smalltalk.method({
  2668. selector: "min:",
  2669. category: 'arithmetic',
  2670. fn: function (aNumber){
  2671. var self=this;
  2672. return smalltalk.withContext(function($ctx1) {
  2673. return Math.min(self, aNumber);;
  2674. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})},
  2675. args: ["aNumber"],
  2676. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  2677. messageSends: [],
  2678. referencedClasses: []
  2679. }),
  2680. smalltalk.Number);
  2681. smalltalk.addMethod(
  2682. smalltalk.method({
  2683. selector: "negated",
  2684. category: 'arithmetic',
  2685. fn: function (){
  2686. var self=this;
  2687. return smalltalk.withContext(function($ctx1) {
  2688. var $1;
  2689. $1=_st((0)).__minus(self);
  2690. return $1;
  2691. }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})},
  2692. args: [],
  2693. source: "negated\x0a\x09^0 - self",
  2694. messageSends: ["-"],
  2695. referencedClasses: []
  2696. }),
  2697. smalltalk.Number);
  2698. smalltalk.addMethod(
  2699. smalltalk.method({
  2700. selector: "negative",
  2701. category: 'testing',
  2702. fn: function (){
  2703. var self=this;
  2704. return smalltalk.withContext(function($ctx1) {
  2705. var $1;
  2706. $1=_st(self).__lt((0));
  2707. return $1;
  2708. }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})},
  2709. args: [],
  2710. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  2711. messageSends: ["<"],
  2712. referencedClasses: []
  2713. }),
  2714. smalltalk.Number);
  2715. smalltalk.addMethod(
  2716. smalltalk.method({
  2717. selector: "odd",
  2718. category: 'testing',
  2719. fn: function (){
  2720. var self=this;
  2721. return smalltalk.withContext(function($ctx1) {
  2722. var $1;
  2723. $1=_st(_st(self)._even())._not();
  2724. return $1;
  2725. }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})},
  2726. args: [],
  2727. source: "odd\x0a\x09^ self even not",
  2728. messageSends: ["not", "even"],
  2729. referencedClasses: []
  2730. }),
  2731. smalltalk.Number);
  2732. smalltalk.addMethod(
  2733. smalltalk.method({
  2734. selector: "positive",
  2735. category: 'testing',
  2736. fn: function (){
  2737. var self=this;
  2738. return smalltalk.withContext(function($ctx1) {
  2739. var $1;
  2740. $1=_st(self).__gt_eq((0));
  2741. return $1;
  2742. }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.Number)})},
  2743. args: [],
  2744. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  2745. messageSends: [">="],
  2746. referencedClasses: []
  2747. }),
  2748. smalltalk.Number);
  2749. smalltalk.addMethod(
  2750. smalltalk.method({
  2751. selector: "printOn:",
  2752. category: 'printing',
  2753. fn: function (aStream){
  2754. var self=this;
  2755. return smalltalk.withContext(function($ctx1) {
  2756. _st(aStream)._nextPutAll_(_st(self)._asString());
  2757. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})},
  2758. args: ["aStream"],
  2759. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2760. messageSends: ["nextPutAll:", "asString"],
  2761. referencedClasses: []
  2762. }),
  2763. smalltalk.Number);
  2764. smalltalk.addMethod(
  2765. smalltalk.method({
  2766. selector: "printShowingDecimalPlaces:",
  2767. category: 'printing',
  2768. fn: function (placesDesired){
  2769. var self=this;
  2770. return smalltalk.withContext(function($ctx1) {
  2771. return self.toFixed(placesDesired);
  2772. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})},
  2773. args: ["placesDesired"],
  2774. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  2775. messageSends: [],
  2776. referencedClasses: []
  2777. }),
  2778. smalltalk.Number);
  2779. smalltalk.addMethod(
  2780. smalltalk.method({
  2781. selector: "rounded",
  2782. category: 'converting',
  2783. fn: function (){
  2784. var self=this;
  2785. return smalltalk.withContext(function($ctx1) {
  2786. return Math.round(self);;
  2787. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})},
  2788. args: [],
  2789. source: "rounded\x0a\x09<return Math.round(self);>",
  2790. messageSends: [],
  2791. referencedClasses: []
  2792. }),
  2793. smalltalk.Number);
  2794. smalltalk.addMethod(
  2795. smalltalk.method({
  2796. selector: "sqrt",
  2797. category: 'arithmetic',
  2798. fn: function (){
  2799. var self=this;
  2800. return smalltalk.withContext(function($ctx1) {
  2801. return Math.sqrt(self);
  2802. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})},
  2803. args: [],
  2804. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  2805. messageSends: [],
  2806. referencedClasses: []
  2807. }),
  2808. smalltalk.Number);
  2809. smalltalk.addMethod(
  2810. smalltalk.method({
  2811. selector: "squared",
  2812. category: 'arithmetic',
  2813. fn: function (){
  2814. var self=this;
  2815. return smalltalk.withContext(function($ctx1) {
  2816. var $1;
  2817. $1=_st(self).__star(self);
  2818. return $1;
  2819. }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})},
  2820. args: [],
  2821. source: "squared\x0a\x09^self * self",
  2822. messageSends: ["*"],
  2823. referencedClasses: []
  2824. }),
  2825. smalltalk.Number);
  2826. smalltalk.addMethod(
  2827. smalltalk.method({
  2828. selector: "timesRepeat:",
  2829. category: 'enumerating',
  2830. fn: function (aBlock){
  2831. var self=this;
  2832. var count;
  2833. return smalltalk.withContext(function($ctx1) {
  2834. count=(1);
  2835. _st((function(){
  2836. return smalltalk.withContext(function($ctx2) {
  2837. return _st(count).__gt(self);
  2838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  2839. return smalltalk.withContext(function($ctx2) {
  2840. _st(aBlock)._value();
  2841. count=_st(count).__plus((1));
  2842. return count;
  2843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2844. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.Number)})},
  2845. args: ["aBlock"],
  2846. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1]",
  2847. messageSends: ["whileFalse:", "value", "+", ">"],
  2848. referencedClasses: []
  2849. }),
  2850. smalltalk.Number);
  2851. smalltalk.addMethod(
  2852. smalltalk.method({
  2853. selector: "to:",
  2854. category: 'converting',
  2855. fn: function (aNumber){
  2856. var self=this;
  2857. var array,first,last,count;
  2858. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2859. return smalltalk.withContext(function($ctx1) {
  2860. var $1;
  2861. first=_st(self)._truncated();
  2862. last=_st(_st(aNumber)._truncated()).__plus((1));
  2863. count=(1);
  2864. array=_st($Array())._new();
  2865. _st(_st(last).__minus(first))._timesRepeat_((function(){
  2866. return smalltalk.withContext(function($ctx2) {
  2867. _st(array)._at_put_(count,first);
  2868. count=_st(count).__plus((1));
  2869. count;
  2870. first=_st(first).__plus((1));
  2871. return first;
  2872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2873. $1=array;
  2874. return $1;
  2875. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.Number)})},
  2876. args: ["aNumber"],
  2877. 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",
  2878. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  2879. referencedClasses: ["Array"]
  2880. }),
  2881. smalltalk.Number);
  2882. smalltalk.addMethod(
  2883. smalltalk.method({
  2884. selector: "to:by:",
  2885. category: 'converting',
  2886. fn: function (stop,step){
  2887. var self=this;
  2888. var array,value,pos;
  2889. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  2890. return smalltalk.withContext(function($ctx1) {
  2891. var $1,$2,$3;
  2892. value=self;
  2893. array=_st($Array())._new();
  2894. pos=(1);
  2895. $1=_st(step).__eq((0));
  2896. if(smalltalk.assert($1)){
  2897. _st(self)._error_("step must be non-zero");
  2898. };
  2899. $2=_st(step).__lt((0));
  2900. if(smalltalk.assert($2)){
  2901. _st((function(){
  2902. return smalltalk.withContext(function($ctx2) {
  2903. return _st(value).__gt_eq(stop);
  2904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  2905. return smalltalk.withContext(function($ctx2) {
  2906. _st(array)._at_put_(pos,value);
  2907. pos=_st(pos).__plus((1));
  2908. pos;
  2909. value=_st(value).__plus(step);
  2910. return value;
  2911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2912. } else {
  2913. _st((function(){
  2914. return smalltalk.withContext(function($ctx2) {
  2915. return _st(value).__lt_eq(stop);
  2916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  2917. return smalltalk.withContext(function($ctx2) {
  2918. _st(array)._at_put_(pos,value);
  2919. pos=_st(pos).__plus((1));
  2920. pos;
  2921. value=_st(value).__plus(step);
  2922. return value;
  2923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2924. };
  2925. $3=array;
  2926. return $3;
  2927. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.Number)})},
  2928. args: ["stop", "step"],
  2929. 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",
  2930. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  2931. referencedClasses: ["Array"]
  2932. }),
  2933. smalltalk.Number);
  2934. smalltalk.addMethod(
  2935. smalltalk.method({
  2936. selector: "to:by:do:",
  2937. category: 'enumerating',
  2938. fn: function (stop,step,aBlock){
  2939. var self=this;
  2940. var value;
  2941. return smalltalk.withContext(function($ctx1) {
  2942. var $1,$2;
  2943. value=self;
  2944. $1=_st(step).__eq((0));
  2945. if(smalltalk.assert($1)){
  2946. _st(self)._error_("step must be non-zero");
  2947. };
  2948. $2=_st(step).__lt((0));
  2949. if(smalltalk.assert($2)){
  2950. _st((function(){
  2951. return smalltalk.withContext(function($ctx2) {
  2952. return _st(value).__gt_eq(stop);
  2953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  2954. return smalltalk.withContext(function($ctx2) {
  2955. _st(aBlock)._value_(value);
  2956. value=_st(value).__plus(step);
  2957. return value;
  2958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2959. } else {
  2960. _st((function(){
  2961. return smalltalk.withContext(function($ctx2) {
  2962. return _st(value).__lt_eq(stop);
  2963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  2964. return smalltalk.withContext(function($ctx2) {
  2965. _st(aBlock)._value_(value);
  2966. value=_st(value).__plus(step);
  2967. return value;
  2968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2969. };
  2970. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.Number)})},
  2971. args: ["stop", "step", "aBlock"],
  2972. 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]]",
  2973. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  2974. referencedClasses: []
  2975. }),
  2976. smalltalk.Number);
  2977. smalltalk.addMethod(
  2978. smalltalk.method({
  2979. selector: "to:do:",
  2980. category: 'enumerating',
  2981. fn: function (stop,aBlock){
  2982. var self=this;
  2983. var nextValue;
  2984. return smalltalk.withContext(function($ctx1) {
  2985. nextValue=self;
  2986. _st((function(){
  2987. return smalltalk.withContext(function($ctx2) {
  2988. return _st(nextValue).__lt_eq(stop);
  2989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  2990. return smalltalk.withContext(function($ctx2) {
  2991. _st(aBlock)._value_(nextValue);
  2992. nextValue=_st(nextValue).__plus((1));
  2993. return nextValue;
  2994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2995. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.Number)})},
  2996. args: ["stop", "aBlock"],
  2997. 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]",
  2998. messageSends: ["whileTrue:", "value:", "+", "<="],
  2999. referencedClasses: []
  3000. }),
  3001. smalltalk.Number);
  3002. smalltalk.addMethod(
  3003. smalltalk.method({
  3004. selector: "truncated",
  3005. category: 'converting',
  3006. fn: function (){
  3007. var self=this;
  3008. return smalltalk.withContext(function($ctx1) {
  3009. if(self >= 0) {
  3010. return Math.floor(self);
  3011. } else {
  3012. return Math.floor(self * (-1)) * (-1);
  3013. };
  3014. ;
  3015. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},smalltalk.Number)})},
  3016. args: [],
  3017. 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>",
  3018. messageSends: [],
  3019. referencedClasses: []
  3020. }),
  3021. smalltalk.Number);
  3022. smalltalk.addMethod(
  3023. smalltalk.method({
  3024. selector: "|",
  3025. category: 'converting',
  3026. fn: function (aNumber){
  3027. var self=this;
  3028. return smalltalk.withContext(function($ctx1) {
  3029. return self | aNumber;
  3030. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})},
  3031. args: ["aNumber"],
  3032. source: "| aNumber\x0a\x09<return self | aNumber>",
  3033. messageSends: [],
  3034. referencedClasses: []
  3035. }),
  3036. smalltalk.Number);
  3037. smalltalk.addMethod(
  3038. smalltalk.method({
  3039. selector: "pi",
  3040. category: 'instance creation',
  3041. fn: function (){
  3042. var self=this;
  3043. return smalltalk.withContext(function($ctx1) {
  3044. return Math.PI;
  3045. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})},
  3046. args: [],
  3047. source: "pi\x0a\x09<return Math.PI>",
  3048. messageSends: [],
  3049. referencedClasses: []
  3050. }),
  3051. smalltalk.Number.klass);
  3052. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  3053. smalltalk.addMethod(
  3054. smalltalk.method({
  3055. selector: "addElement:",
  3056. category: 'accessing',
  3057. fn: function (anObject){
  3058. var self=this;
  3059. return smalltalk.withContext(function($ctx1) {
  3060. self.elements.addElement(anObject);
  3061. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
  3062. args: ["anObject"],
  3063. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  3064. messageSends: [],
  3065. referencedClasses: []
  3066. }),
  3067. smalltalk.Organizer);
  3068. smalltalk.addMethod(
  3069. smalltalk.method({
  3070. selector: "elements",
  3071. category: 'accessing',
  3072. fn: function (){
  3073. var self=this;
  3074. return smalltalk.withContext(function($ctx1) {
  3075. var $1;
  3076. $1=_st(_st(self)._basicAt_("elements"))._copy();
  3077. return $1;
  3078. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
  3079. args: [],
  3080. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  3081. messageSends: ["copy", "basicAt:"],
  3082. referencedClasses: []
  3083. }),
  3084. smalltalk.Organizer);
  3085. smalltalk.addMethod(
  3086. smalltalk.method({
  3087. selector: "removeElement:",
  3088. category: 'accessing',
  3089. fn: function (anObject){
  3090. var self=this;
  3091. return smalltalk.withContext(function($ctx1) {
  3092. self.elements.removeElement(anObject);
  3093. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
  3094. args: ["anObject"],
  3095. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  3096. messageSends: [],
  3097. referencedClasses: []
  3098. }),
  3099. smalltalk.Organizer);
  3100. smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  3101. smalltalk.addMethod(
  3102. smalltalk.method({
  3103. selector: "addElement:",
  3104. category: 'accessing',
  3105. fn: function (aString){
  3106. var self=this;
  3107. function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  3108. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  3109. return smalltalk.withContext(function($ctx1) {
  3110. var $1,$2;
  3111. smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
  3112. $1=_st($ProtocolAdded())._new();
  3113. _st($1)._protocol_(aString);
  3114. _st($1)._theClass_(_st(self)._theClass());
  3115. $2=_st($1)._yourself();
  3116. _st(_st($SystemAnnouncer())._current())._announce_($2);
  3117. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  3118. args: ["aString"],
  3119. 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)",
  3120. messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  3121. referencedClasses: ["ProtocolAdded", "SystemAnnouncer"]
  3122. }),
  3123. smalltalk.ClassOrganizer);
  3124. smalltalk.addMethod(
  3125. smalltalk.method({
  3126. selector: "removeElement:",
  3127. category: 'accessing',
  3128. fn: function (aString){
  3129. var self=this;
  3130. function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  3131. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  3132. return smalltalk.withContext(function($ctx1) {
  3133. var $1,$2;
  3134. smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
  3135. $1=_st($ProtocolRemoved())._new();
  3136. _st($1)._protocol_(aString);
  3137. _st($1)._theClass_(_st(self)._theClass());
  3138. $2=_st($1)._yourself();
  3139. _st(_st($SystemAnnouncer())._current())._announce_($2);
  3140. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  3141. args: ["aString"],
  3142. 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)",
  3143. messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  3144. referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"]
  3145. }),
  3146. smalltalk.ClassOrganizer);
  3147. smalltalk.addMethod(
  3148. smalltalk.method({
  3149. selector: "theClass",
  3150. category: 'accessing',
  3151. fn: function (){
  3152. var self=this;
  3153. return smalltalk.withContext(function($ctx1) {
  3154. return self.theClass ;
  3155. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
  3156. args: [],
  3157. source: "theClass\x0a\x09< return self.theClass >",
  3158. messageSends: [],
  3159. referencedClasses: []
  3160. }),
  3161. smalltalk.ClassOrganizer);
  3162. smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  3163. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  3164. smalltalk.Package.comment="A Package is similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aA Package has a name, an Array of \x22requires\x22, a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name:\x0a\x0a\x09Smalltalk current packageAt: 'Kernel'\x0a\x0a...but you can also use:\x0a\x0a\x09Package named: 'Kernel'\x0a\x0aA Package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a Package supports \x22class extensions\x22 so a Package\x0acan define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows. This can easily be seen in for example class\x0aString where the method category \x22*IDE\x22 defines #inspectOn: which thus is a method belonging to the IDE package.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package fetch: 'Additional-Examples'"
  3165. smalltalk.addMethod(
  3166. smalltalk.method({
  3167. selector: "classes",
  3168. category: 'classes',
  3169. fn: function (){
  3170. var self=this;
  3171. return smalltalk.withContext(function($ctx1) {
  3172. var $1;
  3173. $1=_st(_st(self)._organization())._elements();
  3174. return $1;
  3175. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
  3176. args: [],
  3177. source: "classes\x0a\x09^ self organization elements",
  3178. messageSends: ["elements", "organization"],
  3179. referencedClasses: []
  3180. }),
  3181. smalltalk.Package);
  3182. smalltalk.addMethod(
  3183. smalltalk.method({
  3184. selector: "commitPathJs",
  3185. category: 'accessing',
  3186. fn: function (){
  3187. var self=this;
  3188. return smalltalk.withContext(function($ctx1) {
  3189. var $2,$1;
  3190. $2=self["@commitPathJs"];
  3191. if(($receiver = $2) == nil || $receiver == undefined){
  3192. $1=_st(_st(self)._class())._defaultCommitPathJs();
  3193. } else {
  3194. $1=$2;
  3195. };
  3196. return $1;
  3197. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  3198. args: [],
  3199. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  3200. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  3201. referencedClasses: []
  3202. }),
  3203. smalltalk.Package);
  3204. smalltalk.addMethod(
  3205. smalltalk.method({
  3206. selector: "commitPathJs:",
  3207. category: 'accessing',
  3208. fn: function (aString){
  3209. var self=this;
  3210. return smalltalk.withContext(function($ctx1) {
  3211. self["@commitPathJs"]=aString;
  3212. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  3213. args: ["aString"],
  3214. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  3215. messageSends: [],
  3216. referencedClasses: []
  3217. }),
  3218. smalltalk.Package);
  3219. smalltalk.addMethod(
  3220. smalltalk.method({
  3221. selector: "commitPathSt",
  3222. category: 'accessing',
  3223. fn: function (){
  3224. var self=this;
  3225. return smalltalk.withContext(function($ctx1) {
  3226. var $2,$1;
  3227. $2=self["@commitPathSt"];
  3228. if(($receiver = $2) == nil || $receiver == undefined){
  3229. $1=_st(_st(self)._class())._defaultCommitPathSt();
  3230. } else {
  3231. $1=$2;
  3232. };
  3233. return $1;
  3234. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  3235. args: [],
  3236. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  3237. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  3238. referencedClasses: []
  3239. }),
  3240. smalltalk.Package);
  3241. smalltalk.addMethod(
  3242. smalltalk.method({
  3243. selector: "commitPathSt:",
  3244. category: 'accessing',
  3245. fn: function (aString){
  3246. var self=this;
  3247. return smalltalk.withContext(function($ctx1) {
  3248. self["@commitPathSt"]=aString;
  3249. return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  3250. args: ["aString"],
  3251. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  3252. messageSends: [],
  3253. referencedClasses: []
  3254. }),
  3255. smalltalk.Package);
  3256. smalltalk.addMethod(
  3257. smalltalk.method({
  3258. selector: "isPackage",
  3259. category: 'testing',
  3260. fn: function (){
  3261. var self=this;
  3262. return smalltalk.withContext(function($ctx1) {
  3263. return true;
  3264. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
  3265. args: [],
  3266. source: "isPackage\x0a\x09^ true",
  3267. messageSends: [],
  3268. referencedClasses: []
  3269. }),
  3270. smalltalk.Package);
  3271. smalltalk.addMethod(
  3272. smalltalk.method({
  3273. selector: "name",
  3274. category: 'accessing',
  3275. fn: function (){
  3276. var self=this;
  3277. return smalltalk.withContext(function($ctx1) {
  3278. return self.pkgName;
  3279. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
  3280. args: [],
  3281. source: "name\x0a\x09<return self.pkgName>",
  3282. messageSends: [],
  3283. referencedClasses: []
  3284. }),
  3285. smalltalk.Package);
  3286. smalltalk.addMethod(
  3287. smalltalk.method({
  3288. selector: "name:",
  3289. category: 'accessing',
  3290. fn: function (aString){
  3291. var self=this;
  3292. return smalltalk.withContext(function($ctx1) {
  3293. self.pkgName = aString;
  3294. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
  3295. args: ["aString"],
  3296. source: "name: aString\x0a\x09<self.pkgName = aString>",
  3297. messageSends: [],
  3298. referencedClasses: []
  3299. }),
  3300. smalltalk.Package);
  3301. smalltalk.addMethod(
  3302. smalltalk.method({
  3303. selector: "organization",
  3304. category: 'accessing',
  3305. fn: function (){
  3306. var self=this;
  3307. return smalltalk.withContext(function($ctx1) {
  3308. var $1;
  3309. $1=_st(self)._basicAt_("organization");
  3310. return $1;
  3311. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
  3312. args: [],
  3313. source: "organization\x0a\x09^ self basicAt: 'organization'",
  3314. messageSends: ["basicAt:"],
  3315. referencedClasses: []
  3316. }),
  3317. smalltalk.Package);
  3318. smalltalk.addMethod(
  3319. smalltalk.method({
  3320. selector: "printOn:",
  3321. category: 'printing',
  3322. fn: function (aStream){
  3323. var self=this;
  3324. return smalltalk.withContext(function($ctx1) {
  3325. var $1,$2;
  3326. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  3327. $1=aStream;
  3328. _st($1)._nextPutAll_(" (");
  3329. _st($1)._nextPutAll_(_st(self)._name());
  3330. $2=_st($1)._nextPutAll_(")");
  3331. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
  3332. args: ["aStream"],
  3333. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  3334. messageSends: ["printOn:", "nextPutAll:", "name"],
  3335. referencedClasses: []
  3336. }),
  3337. smalltalk.Package);
  3338. smalltalk.addMethod(
  3339. smalltalk.method({
  3340. selector: "setupClasses",
  3341. category: 'classes',
  3342. fn: function (){
  3343. var self=this;
  3344. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  3345. return smalltalk.withContext(function($ctx1) {
  3346. var $1,$2;
  3347. $1=_st(self)._classes();
  3348. _st($1)._do_((function(each){
  3349. return smalltalk.withContext(function($ctx2) {
  3350. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  3351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3352. $2=_st($1)._do_((function(each){
  3353. return smalltalk.withContext(function($ctx2) {
  3354. return _st(each)._initialize();
  3355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3356. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
  3357. args: [],
  3358. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  3359. messageSends: ["do:", "setupClass:", "new", "classes", "initialize"],
  3360. referencedClasses: ["ClassBuilder"]
  3361. }),
  3362. smalltalk.Package);
  3363. smalltalk.addMethod(
  3364. smalltalk.method({
  3365. selector: "sortedClasses",
  3366. category: 'classes',
  3367. fn: function (){
  3368. var self=this;
  3369. return smalltalk.withContext(function($ctx1) {
  3370. var $1;
  3371. $1=_st(_st(self)._class())._sortedClasses_(_st(self)._classes());
  3372. return $1;
  3373. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})},
  3374. args: [],
  3375. 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",
  3376. messageSends: ["sortedClasses:", "classes", "class"],
  3377. referencedClasses: []
  3378. }),
  3379. smalltalk.Package);
  3380. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  3381. smalltalk.addMethod(
  3382. smalltalk.method({
  3383. selector: "commitPathsFromLoader",
  3384. category: 'commit paths',
  3385. fn: function (){
  3386. var self=this;
  3387. return smalltalk.withContext(function($ctx1) {
  3388. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  3389. if (!commitPath) return;
  3390. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  3391. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  3392. ;
  3393. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.Package.klass)})},
  3394. args: [],
  3395. 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>",
  3396. messageSends: [],
  3397. referencedClasses: []
  3398. }),
  3399. smalltalk.Package.klass);
  3400. smalltalk.addMethod(
  3401. smalltalk.method({
  3402. selector: "defaultCommitPathJs",
  3403. category: 'commit paths',
  3404. fn: function (){
  3405. var self=this;
  3406. return smalltalk.withContext(function($ctx1) {
  3407. var $2,$1;
  3408. $2=self["@defaultCommitPathJs"];
  3409. if(($receiver = $2) == nil || $receiver == undefined){
  3410. self["@defaultCommitPathJs"]="js";
  3411. $1=self["@defaultCommitPathJs"];
  3412. } else {
  3413. $1=$2;
  3414. };
  3415. return $1;
  3416. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.Package.klass)})},
  3417. args: [],
  3418. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  3419. messageSends: ["ifNil:"],
  3420. referencedClasses: []
  3421. }),
  3422. smalltalk.Package.klass);
  3423. smalltalk.addMethod(
  3424. smalltalk.method({
  3425. selector: "defaultCommitPathJs:",
  3426. category: 'commit paths',
  3427. fn: function (aString){
  3428. var self=this;
  3429. return smalltalk.withContext(function($ctx1) {
  3430. self["@defaultCommitPathJs"]=aString;
  3431. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.Package.klass)})},
  3432. args: ["aString"],
  3433. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  3434. messageSends: [],
  3435. referencedClasses: []
  3436. }),
  3437. smalltalk.Package.klass);
  3438. smalltalk.addMethod(
  3439. smalltalk.method({
  3440. selector: "defaultCommitPathSt",
  3441. category: 'commit paths',
  3442. fn: function (){
  3443. var self=this;
  3444. return smalltalk.withContext(function($ctx1) {
  3445. var $2,$1;
  3446. $2=self["@defaultCommitPathSt"];
  3447. if(($receiver = $2) == nil || $receiver == undefined){
  3448. self["@defaultCommitPathSt"]="st";
  3449. $1=self["@defaultCommitPathSt"];
  3450. } else {
  3451. $1=$2;
  3452. };
  3453. return $1;
  3454. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.Package.klass)})},
  3455. args: [],
  3456. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  3457. messageSends: ["ifNil:"],
  3458. referencedClasses: []
  3459. }),
  3460. smalltalk.Package.klass);
  3461. smalltalk.addMethod(
  3462. smalltalk.method({
  3463. selector: "defaultCommitPathSt:",
  3464. category: 'commit paths',
  3465. fn: function (aString){
  3466. var self=this;
  3467. return smalltalk.withContext(function($ctx1) {
  3468. self["@defaultCommitPathSt"]=aString;
  3469. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.Package.klass)})},
  3470. args: ["aString"],
  3471. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  3472. messageSends: [],
  3473. referencedClasses: []
  3474. }),
  3475. smalltalk.Package.klass);
  3476. smalltalk.addMethod(
  3477. smalltalk.method({
  3478. selector: "initialize",
  3479. category: 'initialization',
  3480. fn: function (){
  3481. var self=this;
  3482. return smalltalk.withContext(function($ctx1) {
  3483. smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []);
  3484. _st(self)._commitPathsFromLoader();
  3485. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Package.klass)})},
  3486. args: [],
  3487. source: "initialize\x0a\x09super initialize.\x0a\x09self commitPathsFromLoader",
  3488. messageSends: ["initialize", "commitPathsFromLoader"],
  3489. referencedClasses: []
  3490. }),
  3491. smalltalk.Package.klass);
  3492. smalltalk.addMethod(
  3493. smalltalk.method({
  3494. selector: "load:",
  3495. category: 'loading-storing',
  3496. fn: function (aPackageName){
  3497. var self=this;
  3498. return smalltalk.withContext(function($ctx1) {
  3499. _st(self)._load_prefix_(aPackageName,_st(_st(self)._defaultCommitPathJs()).__comma("/"));
  3500. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  3501. args: ["aPackageName"],
  3502. source: "load: aPackageName\x0a\x09self load: aPackageName prefix: self defaultCommitPathJs, '/'",
  3503. messageSends: ["load:prefix:", ",", "defaultCommitPathJs"],
  3504. referencedClasses: []
  3505. }),
  3506. smalltalk.Package.klass);
  3507. smalltalk.addMethod(
  3508. smalltalk.method({
  3509. selector: "load:prefix:",
  3510. category: 'loading-storing',
  3511. fn: function (aPackageName,aPrefix){
  3512. var self=this;
  3513. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  3514. return smalltalk.withContext(function($ctx1) {
  3515. _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){
  3516. return smalltalk.withContext(function($ctx2) {
  3517. return _st(_st($Package())._named_(aPackageName))._setupClasses();
  3518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3519. return self}, function($ctx1) {$ctx1.fill(self,"load:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix},smalltalk.Package.klass)})},
  3520. args: ["aPackageName", "aPrefix"],
  3521. source: "load: aPackageName prefix: aPrefix\x0a\x09jQuery\x0a\x09\x09getScript: (aPrefix , aPackageName , '.js')\x0a\x09\x09onSuccess: [\x0a\x09\x09\x09(Package named: aPackageName) setupClasses ]",
  3522. messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"],
  3523. referencedClasses: ["Package"]
  3524. }),
  3525. smalltalk.Package.klass);
  3526. smalltalk.addMethod(
  3527. smalltalk.method({
  3528. selector: "named:",
  3529. category: 'accessing',
  3530. fn: function (aPackageName){
  3531. var self=this;
  3532. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3533. return smalltalk.withContext(function($ctx1) {
  3534. var $1;
  3535. $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName);
  3536. return $1;
  3537. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  3538. args: ["aPackageName"],
  3539. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  3540. messageSends: ["packageAt:", "current"],
  3541. referencedClasses: ["Smalltalk"]
  3542. }),
  3543. smalltalk.Package.klass);
  3544. smalltalk.addMethod(
  3545. smalltalk.method({
  3546. selector: "named:ifAbsent:",
  3547. category: 'accessing',
  3548. fn: function (aPackageName,aBlock){
  3549. var self=this;
  3550. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3551. return smalltalk.withContext(function($ctx1) {
  3552. var $1;
  3553. $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  3554. return $1;
  3555. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
  3556. args: ["aPackageName", "aBlock"],
  3557. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  3558. messageSends: ["packageAt:ifAbsent:", "current"],
  3559. referencedClasses: ["Smalltalk"]
  3560. }),
  3561. smalltalk.Package.klass);
  3562. smalltalk.addMethod(
  3563. smalltalk.method({
  3564. selector: "resetCommitPaths",
  3565. category: 'commit paths',
  3566. fn: function (){
  3567. var self=this;
  3568. return smalltalk.withContext(function($ctx1) {
  3569. self["@defaultCommitPathJs"]=nil;
  3570. self["@defaultCommitPathSt"]=nil;
  3571. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.Package.klass)})},
  3572. args: [],
  3573. source: "resetCommitPaths\x0a\x09\x09defaultCommitPathJs := nil.\x0a\x09\x09defaultCommitPathSt := nil.",
  3574. messageSends: [],
  3575. referencedClasses: []
  3576. }),
  3577. smalltalk.Package.klass);
  3578. smalltalk.addMethod(
  3579. smalltalk.method({
  3580. selector: "sortedClasses:",
  3581. category: 'sorting',
  3582. fn: function (classes){
  3583. var self=this;
  3584. var children,others,nodes,expandedClasses;
  3585. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  3586. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3587. return smalltalk.withContext(function($ctx1) {
  3588. var $1,$2;
  3589. children=[];
  3590. others=[];
  3591. _st(classes)._do_((function(each){
  3592. return smalltalk.withContext(function($ctx2) {
  3593. $1=_st(classes)._includes_(_st(each)._superclass());
  3594. if(smalltalk.assert($1)){
  3595. return _st(others)._add_(each);
  3596. } else {
  3597. return _st(children)._add_(each);
  3598. };
  3599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3600. nodes=_st(children)._collect_((function(each){
  3601. return smalltalk.withContext(function($ctx2) {
  3602. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  3603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3604. nodes=_st(nodes)._sorted_((function(a,b){
  3605. return smalltalk.withContext(function($ctx2) {
  3606. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  3607. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  3608. expandedClasses=_st($Array())._new();
  3609. _st(nodes)._do_((function(aNode){
  3610. return smalltalk.withContext(function($ctx2) {
  3611. return _st(aNode)._traverseClassesWith_(expandedClasses);
  3612. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  3613. $2=expandedClasses;
  3614. return $2;
  3615. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})},
  3616. args: ["classes"],
  3617. 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",
  3618. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  3619. referencedClasses: ["ClassSorterNode", "Array"]
  3620. }),
  3621. smalltalk.Package.klass);
  3622. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  3623. smalltalk.Point.comment="A `Point` represents an x-y pair of numbers usually designating a geometric coordinate.\x0aPoints are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a Point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22\x0a\x0aAmber does not have much behavior in this class out-of-the-box."
  3624. smalltalk.addMethod(
  3625. smalltalk.method({
  3626. selector: "*",
  3627. category: 'arithmetic',
  3628. fn: function (aPoint){
  3629. var self=this;
  3630. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3631. return smalltalk.withContext(function($ctx1) {
  3632. var $1;
  3633. $1=_st($Point())._x_y_(_st(_st(self)._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__star(_st(_st(aPoint)._asPoint())._y()));
  3634. return $1;
  3635. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})},
  3636. args: ["aPoint"],
  3637. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  3638. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  3639. referencedClasses: ["Point"]
  3640. }),
  3641. smalltalk.Point);
  3642. smalltalk.addMethod(
  3643. smalltalk.method({
  3644. selector: "+",
  3645. category: 'arithmetic',
  3646. fn: function (aPoint){
  3647. var self=this;
  3648. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3649. return smalltalk.withContext(function($ctx1) {
  3650. var $1;
  3651. $1=_st($Point())._x_y_(_st(_st(self)._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
  3652. return $1;
  3653. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})},
  3654. args: ["aPoint"],
  3655. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  3656. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  3657. referencedClasses: ["Point"]
  3658. }),
  3659. smalltalk.Point);
  3660. smalltalk.addMethod(
  3661. smalltalk.method({
  3662. selector: "-",
  3663. category: 'arithmetic',
  3664. fn: function (aPoint){
  3665. var self=this;
  3666. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3667. return smalltalk.withContext(function($ctx1) {
  3668. var $1;
  3669. $1=_st($Point())._x_y_(_st(_st(self)._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
  3670. return $1;
  3671. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})},
  3672. args: ["aPoint"],
  3673. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  3674. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  3675. referencedClasses: ["Point"]
  3676. }),
  3677. smalltalk.Point);
  3678. smalltalk.addMethod(
  3679. smalltalk.method({
  3680. selector: "/",
  3681. category: 'arithmetic',
  3682. fn: function (aPoint){
  3683. var self=this;
  3684. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3685. return smalltalk.withContext(function($ctx1) {
  3686. var $1;
  3687. $1=_st($Point())._x_y_(_st(_st(self)._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(_st(self)._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
  3688. return $1;
  3689. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})},
  3690. args: ["aPoint"],
  3691. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  3692. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  3693. referencedClasses: ["Point"]
  3694. }),
  3695. smalltalk.Point);
  3696. smalltalk.addMethod(
  3697. smalltalk.method({
  3698. selector: "=",
  3699. category: 'arithmetic',
  3700. fn: function (aPoint){
  3701. var self=this;
  3702. return smalltalk.withContext(function($ctx1) {
  3703. var $1;
  3704. $1=_st(_st(_st(aPoint)._class()).__eq(_st(self)._class()))._and_((function(){
  3705. return smalltalk.withContext(function($ctx2) {
  3706. return _st(_st(_st(aPoint)._x()).__eq(_st(self)._x())).__and(_st(_st(aPoint)._y()).__eq(_st(self)._y()));
  3707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3708. return $1;
  3709. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})},
  3710. args: ["aPoint"],
  3711. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  3712. messageSends: ["and:", "&", "=", "y", "x", "class"],
  3713. referencedClasses: []
  3714. }),
  3715. smalltalk.Point);
  3716. smalltalk.addMethod(
  3717. smalltalk.method({
  3718. selector: "asPoint",
  3719. category: 'converting',
  3720. fn: function (){
  3721. var self=this;
  3722. return smalltalk.withContext(function($ctx1) {
  3723. var $1;
  3724. $1=self;
  3725. return $1;
  3726. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})},
  3727. args: [],
  3728. source: "asPoint\x0a\x09^self",
  3729. messageSends: [],
  3730. referencedClasses: []
  3731. }),
  3732. smalltalk.Point);
  3733. smalltalk.addMethod(
  3734. smalltalk.method({
  3735. selector: "printOn:",
  3736. category: 'printing',
  3737. fn: function (aStream){
  3738. var self=this;
  3739. return smalltalk.withContext(function($ctx1) {
  3740. var $1;
  3741. _st(self["@x"])._printOn_(aStream);
  3742. _st(aStream)._nextPutAll_("@");
  3743. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  3744. return smalltalk.withContext(function($ctx2) {
  3745. return _st(self["@y"])._negative();
  3746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3747. if(smalltalk.assert($1)){
  3748. _st(aStream)._space();
  3749. };
  3750. _st(self["@y"])._printOn_(aStream);
  3751. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Point)})},
  3752. args: ["aStream"],
  3753. 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",
  3754. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "space", "and:", "negative", "notNil"],
  3755. referencedClasses: []
  3756. }),
  3757. smalltalk.Point);
  3758. smalltalk.addMethod(
  3759. smalltalk.method({
  3760. selector: "translateBy:",
  3761. category: 'transforming',
  3762. fn: function (delta){
  3763. var self=this;
  3764. return smalltalk.withContext(function($ctx1) {
  3765. var $1;
  3766. $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  3767. return $1;
  3768. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.Point)})},
  3769. args: ["delta"],
  3770. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  3771. messageSends: ["@", "+", "y", "x"],
  3772. referencedClasses: []
  3773. }),
  3774. smalltalk.Point);
  3775. smalltalk.addMethod(
  3776. smalltalk.method({
  3777. selector: "x",
  3778. category: 'accessing',
  3779. fn: function (){
  3780. var self=this;
  3781. return smalltalk.withContext(function($ctx1) {
  3782. var $1;
  3783. $1=self["@x"];
  3784. return $1;
  3785. }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})},
  3786. args: [],
  3787. source: "x\x0a\x09^x",
  3788. messageSends: [],
  3789. referencedClasses: []
  3790. }),
  3791. smalltalk.Point);
  3792. smalltalk.addMethod(
  3793. smalltalk.method({
  3794. selector: "x:",
  3795. category: 'accessing',
  3796. fn: function (aNumber){
  3797. var self=this;
  3798. return smalltalk.withContext(function($ctx1) {
  3799. self["@x"]=aNumber;
  3800. return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})},
  3801. args: ["aNumber"],
  3802. source: "x: aNumber\x0a\x09x := aNumber",
  3803. messageSends: [],
  3804. referencedClasses: []
  3805. }),
  3806. smalltalk.Point);
  3807. smalltalk.addMethod(
  3808. smalltalk.method({
  3809. selector: "y",
  3810. category: 'accessing',
  3811. fn: function (){
  3812. var self=this;
  3813. return smalltalk.withContext(function($ctx1) {
  3814. var $1;
  3815. $1=self["@y"];
  3816. return $1;
  3817. }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})},
  3818. args: [],
  3819. source: "y\x0a\x09^y",
  3820. messageSends: [],
  3821. referencedClasses: []
  3822. }),
  3823. smalltalk.Point);
  3824. smalltalk.addMethod(
  3825. smalltalk.method({
  3826. selector: "y:",
  3827. category: 'accessing',
  3828. fn: function (aNumber){
  3829. var self=this;
  3830. return smalltalk.withContext(function($ctx1) {
  3831. self["@y"]=aNumber;
  3832. return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})},
  3833. args: ["aNumber"],
  3834. source: "y: aNumber\x0a\x09y := aNumber",
  3835. messageSends: [],
  3836. referencedClasses: []
  3837. }),
  3838. smalltalk.Point);
  3839. smalltalk.addMethod(
  3840. smalltalk.method({
  3841. selector: "x:y:",
  3842. category: 'instance creation',
  3843. fn: function (aNumber,anotherNumber){
  3844. var self=this;
  3845. return smalltalk.withContext(function($ctx1) {
  3846. var $2,$3,$1;
  3847. $2=_st(self)._new();
  3848. _st($2)._x_(aNumber);
  3849. _st($2)._y_(anotherNumber);
  3850. $3=_st($2)._yourself();
  3851. $1=$3;
  3852. return $1;
  3853. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Point.klass)})},
  3854. args: ["aNumber", "anotherNumber"],
  3855. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  3856. messageSends: ["x:", "new", "y:", "yourself"],
  3857. referencedClasses: []
  3858. }),
  3859. smalltalk.Point.klass);
  3860. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  3861. smalltalk.Random.comment="`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0a...and if you want a random number in a specific interval this also works:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0a...but be aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0a...or perhaps a letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`."
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "next",
  3865. category: 'accessing',
  3866. fn: function (){
  3867. var self=this;
  3868. return smalltalk.withContext(function($ctx1) {
  3869. return Math.random();
  3870. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})},
  3871. args: [],
  3872. source: "next\x0a\x09<return Math.random()>",
  3873. messageSends: [],
  3874. referencedClasses: []
  3875. }),
  3876. smalltalk.Random);
  3877. smalltalk.addMethod(
  3878. smalltalk.method({
  3879. selector: "next:",
  3880. category: 'accessing',
  3881. fn: function (anInteger){
  3882. var self=this;
  3883. return smalltalk.withContext(function($ctx1) {
  3884. var $1;
  3885. $1=_st(_st((1))._to_(anInteger))._collect_((function(each){
  3886. return smalltalk.withContext(function($ctx2) {
  3887. return _st(self)._next();
  3888. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3889. return $1;
  3890. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})},
  3891. args: ["anInteger"],
  3892. source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]",
  3893. messageSends: ["collect:", "next", "to:"],
  3894. referencedClasses: []
  3895. }),
  3896. smalltalk.Random);
  3897. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  3898. smalltalk.Smalltalk.comment="Smalltalk has only one instance, accessed with `Smalltalk current`.\x0aIt represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class of `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific class of `nil`\x0a\x0a__note:__ classes and packages are accessed using strings, not symbols\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Smalltalk source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work"
  3899. smalltalk.addMethod(
  3900. smalltalk.method({
  3901. selector: "asSmalltalkException:",
  3902. category: 'error handling',
  3903. fn: function (anObject){
  3904. var self=this;
  3905. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  3906. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3907. return smalltalk.withContext(function($ctx1) {
  3908. var $2,$1;
  3909. $2=_st(_st(self)._isSmalltalkObject_(anObject))._and_((function(){
  3910. return smalltalk.withContext(function($ctx2) {
  3911. return _st(anObject)._isKindOf_($Error());
  3912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3913. if(smalltalk.assert($2)){
  3914. $1=anObject;
  3915. } else {
  3916. $1=_st($JavaScriptException())._on_(anObject);
  3917. };
  3918. return $1;
  3919. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
  3920. args: ["anObject"],
  3921. 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 ]",
  3922. messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"],
  3923. referencedClasses: ["JavaScriptException", "Error"]
  3924. }),
  3925. smalltalk.Smalltalk);
  3926. smalltalk.addMethod(
  3927. smalltalk.method({
  3928. selector: "at:",
  3929. category: 'accessing',
  3930. fn: function (aString){
  3931. var self=this;
  3932. return smalltalk.withContext(function($ctx1) {
  3933. return self[aString];
  3934. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
  3935. args: ["aString"],
  3936. source: "at: aString\x0a\x09<return self[aString]>",
  3937. messageSends: [],
  3938. referencedClasses: []
  3939. }),
  3940. smalltalk.Smalltalk);
  3941. smalltalk.addMethod(
  3942. smalltalk.method({
  3943. selector: "basicParse:",
  3944. category: 'private',
  3945. fn: function (aString){
  3946. var self=this;
  3947. return smalltalk.withContext(function($ctx1) {
  3948. return smalltalk.parser.parse(aString);
  3949. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
  3950. args: ["aString"],
  3951. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  3952. messageSends: [],
  3953. referencedClasses: []
  3954. }),
  3955. smalltalk.Smalltalk);
  3956. smalltalk.addMethod(
  3957. smalltalk.method({
  3958. selector: "classes",
  3959. category: 'classes',
  3960. fn: function (){
  3961. var self=this;
  3962. return smalltalk.withContext(function($ctx1) {
  3963. return self.classes();
  3964. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
  3965. args: [],
  3966. source: "classes\x0a\x09<return self.classes()>",
  3967. messageSends: [],
  3968. referencedClasses: []
  3969. }),
  3970. smalltalk.Smalltalk);
  3971. smalltalk.addMethod(
  3972. smalltalk.method({
  3973. selector: "createPackage:",
  3974. category: 'packages',
  3975. fn: function (packageName){
  3976. var self=this;
  3977. return smalltalk.withContext(function($ctx1) {
  3978. return smalltalk.addPackage(packageName);
  3979. return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  3980. args: ["packageName"],
  3981. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  3982. messageSends: [],
  3983. referencedClasses: []
  3984. }),
  3985. smalltalk.Smalltalk);
  3986. smalltalk.addMethod(
  3987. smalltalk.method({
  3988. selector: "createPackage:properties:",
  3989. category: 'private',
  3990. fn: function (packageName,aDict){
  3991. var self=this;
  3992. return smalltalk.withContext(function($ctx1) {
  3993. var $1,$2;
  3994. _st(self)._deprecatedAPI();
  3995. $1=_st(aDict)._isEmpty();
  3996. if(! smalltalk.assert($1)){
  3997. _st(self)._error_("createPackage:properties: called with nonempty properties");
  3998. };
  3999. $2=_st(self)._createPackage_(packageName);
  4000. return $2;
  4001. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
  4002. args: ["packageName", "aDict"],
  4003. 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",
  4004. messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"],
  4005. referencedClasses: []
  4006. }),
  4007. smalltalk.Smalltalk);
  4008. smalltalk.addMethod(
  4009. smalltalk.method({
  4010. selector: "deleteClass:",
  4011. category: 'classes',
  4012. fn: function (aClass){
  4013. var self=this;
  4014. return smalltalk.withContext(function($ctx1) {
  4015. self.removeClass(aClass);
  4016. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  4017. args: ["aClass"],
  4018. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
  4019. messageSends: [],
  4020. referencedClasses: []
  4021. }),
  4022. smalltalk.Smalltalk);
  4023. smalltalk.addMethod(
  4024. smalltalk.method({
  4025. selector: "deletePackage:",
  4026. category: 'packages',
  4027. fn: function (packageName){
  4028. var self=this;
  4029. return smalltalk.withContext(function($ctx1) {
  4030. delete smalltalk.packages[packageName];
  4031. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  4032. args: ["packageName"],
  4033. 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]>",
  4034. messageSends: [],
  4035. referencedClasses: []
  4036. }),
  4037. smalltalk.Smalltalk);
  4038. smalltalk.addMethod(
  4039. smalltalk.method({
  4040. selector: "isSmalltalkObject:",
  4041. category: 'testing',
  4042. fn: function (anObject){
  4043. var self=this;
  4044. return smalltalk.withContext(function($ctx1) {
  4045. return typeof anObject.klass !== 'undefined';
  4046. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  4047. args: ["anObject"],
  4048. 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'>",
  4049. messageSends: [],
  4050. referencedClasses: []
  4051. }),
  4052. smalltalk.Smalltalk);
  4053. smalltalk.addMethod(
  4054. smalltalk.method({
  4055. selector: "packageAt:",
  4056. category: 'packages',
  4057. fn: function (packageName){
  4058. var self=this;
  4059. return smalltalk.withContext(function($ctx1) {
  4060. return self.packages[packageName];
  4061. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
  4062. args: ["packageName"],
  4063. source: "packageAt: packageName\x0a\x09<return self.packages[packageName]>",
  4064. messageSends: [],
  4065. referencedClasses: []
  4066. }),
  4067. smalltalk.Smalltalk);
  4068. smalltalk.addMethod(
  4069. smalltalk.method({
  4070. selector: "packageAt:ifAbsent:",
  4071. category: 'packages',
  4072. fn: function (packageName,aBlock){
  4073. var self=this;
  4074. return smalltalk.withContext(function($ctx1) {
  4075. var $2,$1;
  4076. $2=_st(self)._packageAt_(packageName);
  4077. $1=_st($2)._ifNil_(aBlock);
  4078. return $1;
  4079. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
  4080. args: ["packageName", "aBlock"],
  4081. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock",
  4082. messageSends: ["ifNil:", "packageAt:"],
  4083. referencedClasses: []
  4084. }),
  4085. smalltalk.Smalltalk);
  4086. smalltalk.addMethod(
  4087. smalltalk.method({
  4088. selector: "packages",
  4089. category: 'packages',
  4090. fn: function (){
  4091. var self=this;
  4092. return smalltalk.withContext(function($ctx1) {
  4093. return self.packages.all();
  4094. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
  4095. args: [],
  4096. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  4097. messageSends: [],
  4098. referencedClasses: []
  4099. }),
  4100. smalltalk.Smalltalk);
  4101. smalltalk.addMethod(
  4102. smalltalk.method({
  4103. selector: "parse:",
  4104. category: 'accessing',
  4105. fn: function (aString){
  4106. var self=this;
  4107. var result;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. var $1;
  4110. _st(self)._try_catch_((function(){
  4111. return smalltalk.withContext(function($ctx2) {
  4112. result=_st(self)._basicParse_(aString);
  4113. return result;
  4114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){
  4115. return smalltalk.withContext(function($ctx2) {
  4116. return _st(_st(self)._parseError_parsing_(ex,aString))._signal();
  4117. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  4118. $1=result;
  4119. return $1;
  4120. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
  4121. args: ["aString"],
  4122. source: "parse: aString\x0a\x09| result |\x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  4123. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  4124. referencedClasses: []
  4125. }),
  4126. smalltalk.Smalltalk);
  4127. smalltalk.addMethod(
  4128. smalltalk.method({
  4129. selector: "parseError:parsing:",
  4130. category: 'error handling',
  4131. fn: function (anException,aString){
  4132. var self=this;
  4133. function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  4134. return smalltalk.withContext(function($ctx1) {
  4135. var $1;
  4136. $1=_st(_st($ParseError())._new())._messageText_(_st(_st(_st(_st(_st("Parse error on line ").__comma(_st(anException)._basicAt_("line"))).__comma(" column ")).__comma(_st(anException)._basicAt_("column"))).__comma(" : Unexpected character ")).__comma(_st(anException)._basicAt_("found")));
  4137. return $1;
  4138. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
  4139. args: ["anException", "aString"],
  4140. 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')",
  4141. messageSends: ["messageText:", ",", "basicAt:", "new"],
  4142. referencedClasses: ["ParseError"]
  4143. }),
  4144. smalltalk.Smalltalk);
  4145. smalltalk.addMethod(
  4146. smalltalk.method({
  4147. selector: "pseudoVariableNames",
  4148. category: 'packages',
  4149. fn: function (){
  4150. var self=this;
  4151. return smalltalk.withContext(function($ctx1) {
  4152. var $1;
  4153. $1=["self", "super", "nil", "true", "false", "thisContext"];
  4154. return $1;
  4155. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
  4156. args: [],
  4157. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  4158. messageSends: [],
  4159. referencedClasses: []
  4160. }),
  4161. smalltalk.Smalltalk);
  4162. smalltalk.addMethod(
  4163. smalltalk.method({
  4164. selector: "readJSObject:",
  4165. category: 'accessing',
  4166. fn: function (anObject){
  4167. var self=this;
  4168. return smalltalk.withContext(function($ctx1) {
  4169. return self.readJSObject(anObject);
  4170. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  4171. args: ["anObject"],
  4172. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  4173. messageSends: [],
  4174. referencedClasses: []
  4175. }),
  4176. smalltalk.Smalltalk);
  4177. smalltalk.addMethod(
  4178. smalltalk.method({
  4179. selector: "removeClass:",
  4180. category: 'classes',
  4181. fn: function (aClass){
  4182. var self=this;
  4183. function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  4184. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4185. return smalltalk.withContext(function($ctx1) {
  4186. var $1,$2,$3;
  4187. $1=_st(aClass)._isMetaclass();
  4188. if(smalltalk.assert($1)){
  4189. _st(self)._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  4190. };
  4191. _st(self)._deleteClass_(aClass);
  4192. $2=_st($ClassRemoved())._new();
  4193. _st($2)._theClass_(aClass);
  4194. $3=_st($2)._yourself();
  4195. _st(_st($SystemAnnouncer())._current())._announce_($3);
  4196. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  4197. args: ["aClass"],
  4198. 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)",
  4199. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  4200. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  4201. }),
  4202. smalltalk.Smalltalk);
  4203. smalltalk.addMethod(
  4204. smalltalk.method({
  4205. selector: "removePackage:",
  4206. category: 'packages',
  4207. fn: function (packageName){
  4208. var self=this;
  4209. var pkg;
  4210. return smalltalk.withContext(function($ctx1) {
  4211. pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
  4212. return smalltalk.withContext(function($ctx2) {
  4213. return _st(self)._error_(_st("Missing package: ").__comma(packageName));
  4214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4215. _st(_st(pkg)._classes())._do_((function(each){
  4216. return smalltalk.withContext(function($ctx2) {
  4217. return _st(self)._removeClass_(each);
  4218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4219. _st(self)._deletePackage_(packageName);
  4220. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
  4221. args: ["packageName"],
  4222. 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",
  4223. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  4224. referencedClasses: []
  4225. }),
  4226. smalltalk.Smalltalk);
  4227. smalltalk.addMethod(
  4228. smalltalk.method({
  4229. selector: "renamePackage:to:",
  4230. category: 'packages',
  4231. fn: function (packageName,newName){
  4232. var self=this;
  4233. var pkg;
  4234. return smalltalk.withContext(function($ctx1) {
  4235. var $1;
  4236. pkg=_st(self)._packageAt_ifAbsent_(packageName,(function(){
  4237. return smalltalk.withContext(function($ctx2) {
  4238. return _st(self)._error_(_st("Missing package: ").__comma(packageName));
  4239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4240. $1=_st(self)._packageAt_(newName);
  4241. if(($receiver = $1) == nil || $receiver == undefined){
  4242. $1;
  4243. } else {
  4244. _st(self)._error_(_st("Already exists a package called: ").__comma(newName));
  4245. };
  4246. _st(_st(self)._basicAt_("packages"))._at_put_(newName,pkg);
  4247. _st(pkg)._name_(newName);
  4248. _st(self)._deletePackage_(packageName);
  4249. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
  4250. args: ["packageName", "newName"],
  4251. 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.",
  4252. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
  4253. referencedClasses: []
  4254. }),
  4255. smalltalk.Smalltalk);
  4256. smalltalk.addMethod(
  4257. smalltalk.method({
  4258. selector: "reservedWords",
  4259. category: 'accessing',
  4260. fn: function (){
  4261. var self=this;
  4262. return smalltalk.withContext(function($ctx1) {
  4263. return self.reservedWords;
  4264. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
  4265. args: [],
  4266. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  4267. messageSends: [],
  4268. referencedClasses: []
  4269. }),
  4270. smalltalk.Smalltalk);
  4271. smalltalk.addMethod(
  4272. smalltalk.method({
  4273. selector: "version",
  4274. category: 'accessing',
  4275. fn: function (){
  4276. var self=this;
  4277. return smalltalk.withContext(function($ctx1) {
  4278. return "0.10";
  4279. }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
  4280. args: [],
  4281. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.10'",
  4282. messageSends: [],
  4283. referencedClasses: []
  4284. }),
  4285. smalltalk.Smalltalk);
  4286. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  4287. smalltalk.addMethod(
  4288. smalltalk.method({
  4289. selector: "current",
  4290. category: 'accessing',
  4291. fn: function (){
  4292. var self=this;
  4293. return smalltalk.withContext(function($ctx1) {
  4294. return smalltalk;
  4295. return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
  4296. args: [],
  4297. source: "current\x0a\x09<return smalltalk>",
  4298. messageSends: [],
  4299. referencedClasses: []
  4300. }),
  4301. smalltalk.Smalltalk.klass);
  4302. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  4303. smalltalk.Timeout.comment="I am wrapping the returns from set{Timeout,Interval}.\x0a\x0aNumber suffices in browsers, but node.js returns an object."
  4304. smalltalk.addMethod(
  4305. smalltalk.method({
  4306. selector: "clearInterval",
  4307. category: 'timeout/interval',
  4308. fn: function (){
  4309. var self=this;
  4310. return smalltalk.withContext(function($ctx1) {
  4311. var interval = self["@rawTimeout"];
  4312. clearInterval(interval);
  4313. ;
  4314. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})},
  4315. args: [],
  4316. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  4317. messageSends: [],
  4318. referencedClasses: []
  4319. }),
  4320. smalltalk.Timeout);
  4321. smalltalk.addMethod(
  4322. smalltalk.method({
  4323. selector: "clearTimeout",
  4324. category: 'timeout/interval',
  4325. fn: function (){
  4326. var self=this;
  4327. return smalltalk.withContext(function($ctx1) {
  4328. var timeout = self["@rawTimeout"];
  4329. clearTimeout(timeout);
  4330. ;
  4331. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})},
  4332. args: [],
  4333. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  4334. messageSends: [],
  4335. referencedClasses: []
  4336. }),
  4337. smalltalk.Timeout);
  4338. smalltalk.addMethod(
  4339. smalltalk.method({
  4340. selector: "rawTimeout:",
  4341. category: 'accessing',
  4342. fn: function (anObject){
  4343. var self=this;
  4344. return smalltalk.withContext(function($ctx1) {
  4345. self["@rawTimeout"]=anObject;
  4346. return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})},
  4347. args: ["anObject"],
  4348. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  4349. messageSends: [],
  4350. referencedClasses: []
  4351. }),
  4352. smalltalk.Timeout);
  4353. smalltalk.addMethod(
  4354. smalltalk.method({
  4355. selector: "on:",
  4356. category: 'instance creation',
  4357. fn: function (anObject){
  4358. var self=this;
  4359. return smalltalk.withContext(function($ctx1) {
  4360. var $2,$3,$1;
  4361. $2=_st(self)._new();
  4362. _st($2)._rawTimeout_(anObject);
  4363. $3=_st($2)._yourself();
  4364. $1=$3;
  4365. return $1;
  4366. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})},
  4367. args: ["anObject"],
  4368. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  4369. messageSends: ["rawTimeout:", "new", "yourself"],
  4370. referencedClasses: []
  4371. }),
  4372. smalltalk.Timeout.klass);
  4373. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  4374. smalltalk.UndefinedObject.comment="UndefinedObject describes the behavior of its sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk representation of the `undefined` JavaScript object."
  4375. smalltalk.addMethod(
  4376. smalltalk.method({
  4377. selector: "asJSON",
  4378. category: 'converting',
  4379. fn: function (){
  4380. var self=this;
  4381. return smalltalk.withContext(function($ctx1) {
  4382. var $1;
  4383. $1=null;
  4384. return $1;
  4385. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})},
  4386. args: [],
  4387. source: "asJSON\x0a\x09^null",
  4388. messageSends: [],
  4389. referencedClasses: []
  4390. }),
  4391. smalltalk.UndefinedObject);
  4392. smalltalk.addMethod(
  4393. smalltalk.method({
  4394. selector: "deepCopy",
  4395. category: 'copying',
  4396. fn: function (){
  4397. var self=this;
  4398. return smalltalk.withContext(function($ctx1) {
  4399. var $1;
  4400. $1=self;
  4401. return $1;
  4402. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})},
  4403. args: [],
  4404. source: "deepCopy\x0a\x09^self",
  4405. messageSends: [],
  4406. referencedClasses: []
  4407. }),
  4408. smalltalk.UndefinedObject);
  4409. smalltalk.addMethod(
  4410. smalltalk.method({
  4411. selector: "ifNil:",
  4412. category: 'testing',
  4413. fn: function (aBlock){
  4414. var self=this;
  4415. return smalltalk.withContext(function($ctx1) {
  4416. var $2,$1;
  4417. $2=self;
  4418. $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
  4419. return smalltalk.withContext(function($ctx2) {
  4420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4421. return $1;
  4422. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  4423. args: ["aBlock"],
  4424. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  4425. messageSends: ["ifNil:ifNotNil:"],
  4426. referencedClasses: []
  4427. }),
  4428. smalltalk.UndefinedObject);
  4429. smalltalk.addMethod(
  4430. smalltalk.method({
  4431. selector: "ifNil:ifNotNil:",
  4432. category: 'testing',
  4433. fn: function (aBlock,anotherBlock){
  4434. var self=this;
  4435. return smalltalk.withContext(function($ctx1) {
  4436. var $1;
  4437. $1=_st(aBlock)._value();
  4438. return $1;
  4439. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  4440. args: ["aBlock", "anotherBlock"],
  4441. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  4442. messageSends: ["value"],
  4443. referencedClasses: []
  4444. }),
  4445. smalltalk.UndefinedObject);
  4446. smalltalk.addMethod(
  4447. smalltalk.method({
  4448. selector: "ifNotNil:",
  4449. category: 'testing',
  4450. fn: function (aBlock){
  4451. var self=this;
  4452. return smalltalk.withContext(function($ctx1) {
  4453. var $1;
  4454. $1=self;
  4455. return $1;
  4456. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  4457. args: ["aBlock"],
  4458. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  4459. messageSends: [],
  4460. referencedClasses: []
  4461. }),
  4462. smalltalk.UndefinedObject);
  4463. smalltalk.addMethod(
  4464. smalltalk.method({
  4465. selector: "ifNotNil:ifNil:",
  4466. category: 'testing',
  4467. fn: function (aBlock,anotherBlock){
  4468. var self=this;
  4469. return smalltalk.withContext(function($ctx1) {
  4470. var $1;
  4471. $1=_st(anotherBlock)._value();
  4472. return $1;
  4473. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  4474. args: ["aBlock", "anotherBlock"],
  4475. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  4476. messageSends: ["value"],
  4477. referencedClasses: []
  4478. }),
  4479. smalltalk.UndefinedObject);
  4480. smalltalk.addMethod(
  4481. smalltalk.method({
  4482. selector: "isImmutable",
  4483. category: 'testing',
  4484. fn: function (){
  4485. var self=this;
  4486. return smalltalk.withContext(function($ctx1) {
  4487. return true;
  4488. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})},
  4489. args: [],
  4490. source: "isImmutable\x0a\x09^ true",
  4491. messageSends: [],
  4492. referencedClasses: []
  4493. }),
  4494. smalltalk.UndefinedObject);
  4495. smalltalk.addMethod(
  4496. smalltalk.method({
  4497. selector: "isNil",
  4498. category: 'testing',
  4499. fn: function (){
  4500. var self=this;
  4501. return smalltalk.withContext(function($ctx1) {
  4502. return true;
  4503. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})},
  4504. args: [],
  4505. source: "isNil\x0a\x09^true",
  4506. messageSends: [],
  4507. referencedClasses: []
  4508. }),
  4509. smalltalk.UndefinedObject);
  4510. smalltalk.addMethod(
  4511. smalltalk.method({
  4512. selector: "notNil",
  4513. category: 'testing',
  4514. fn: function (){
  4515. var self=this;
  4516. return smalltalk.withContext(function($ctx1) {
  4517. return false;
  4518. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})},
  4519. args: [],
  4520. source: "notNil\x0a\x09^false",
  4521. messageSends: [],
  4522. referencedClasses: []
  4523. }),
  4524. smalltalk.UndefinedObject);
  4525. smalltalk.addMethod(
  4526. smalltalk.method({
  4527. selector: "printOn:",
  4528. category: 'printing',
  4529. fn: function (aStream){
  4530. var self=this;
  4531. return smalltalk.withContext(function($ctx1) {
  4532. _st(aStream)._nextPutAll_("nil");
  4533. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})},
  4534. args: ["aStream"],
  4535. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  4536. messageSends: ["nextPutAll:"],
  4537. referencedClasses: []
  4538. }),
  4539. smalltalk.UndefinedObject);
  4540. smalltalk.addMethod(
  4541. smalltalk.method({
  4542. selector: "shallowCopy",
  4543. category: 'copying',
  4544. fn: function (){
  4545. var self=this;
  4546. return smalltalk.withContext(function($ctx1) {
  4547. var $1;
  4548. $1=self;
  4549. return $1;
  4550. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})},
  4551. args: [],
  4552. source: "shallowCopy\x0a\x09^self",
  4553. messageSends: [],
  4554. referencedClasses: []
  4555. }),
  4556. smalltalk.UndefinedObject);
  4557. smalltalk.addMethod(
  4558. smalltalk.method({
  4559. selector: "subclass:instanceVariableNames:",
  4560. category: 'class creation',
  4561. fn: function (aString,anotherString){
  4562. var self=this;
  4563. return smalltalk.withContext(function($ctx1) {
  4564. var $1;
  4565. $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  4566. return $1;
  4567. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})},
  4568. args: ["aString", "anotherString"],
  4569. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4570. messageSends: ["subclass:instanceVariableNames:package:"],
  4571. referencedClasses: []
  4572. }),
  4573. smalltalk.UndefinedObject);
  4574. smalltalk.addMethod(
  4575. smalltalk.method({
  4576. selector: "subclass:instanceVariableNames:category:",
  4577. category: 'class creation',
  4578. fn: function (aString,aString2,aString3){
  4579. var self=this;
  4580. return smalltalk.withContext(function($ctx1) {
  4581. var $1;
  4582. _st(self)._deprecatedAPI();
  4583. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  4584. return $1;
  4585. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  4586. args: ["aString", "aString2", "aString3"],
  4587. 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",
  4588. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4589. referencedClasses: []
  4590. }),
  4591. smalltalk.UndefinedObject);
  4592. smalltalk.addMethod(
  4593. smalltalk.method({
  4594. selector: "subclass:instanceVariableNames:package:",
  4595. category: 'class creation',
  4596. fn: function (aString,aString2,aString3){
  4597. var self=this;
  4598. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  4599. return smalltalk.withContext(function($ctx1) {
  4600. var $1;
  4601. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  4602. return $1;
  4603. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  4604. args: ["aString", "aString2", "aString3"],
  4605. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  4606. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  4607. referencedClasses: ["ClassBuilder"]
  4608. }),
  4609. smalltalk.UndefinedObject);
  4610. smalltalk.addMethod(
  4611. smalltalk.method({
  4612. selector: "new",
  4613. category: 'instance creation',
  4614. fn: function (){
  4615. var self=this;
  4616. return smalltalk.withContext(function($ctx1) {
  4617. _st(self)._error_("You cannot create new instances of UndefinedObject. Use nil");
  4618. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})},
  4619. args: [],
  4620. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4621. messageSends: ["error:"],
  4622. referencedClasses: []
  4623. }),
  4624. smalltalk.UndefinedObject.klass);
  4625. smalltalk.addMethod(
  4626. smalltalk.method({
  4627. selector: "asJavaScriptSelector",
  4628. category: '*Kernel-Objects',
  4629. fn: function (){
  4630. var self=this;
  4631. return smalltalk.withContext(function($ctx1) {
  4632. var $1;
  4633. $1=_st(self)._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  4634. return $1;
  4635. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
  4636. args: [],
  4637. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  4638. messageSends: ["replace:with:"],
  4639. referencedClasses: []
  4640. }),
  4641. smalltalk.String);