2
0

Kernel-Objects.js 124 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044
  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 Overriding this message can be useful to implement proxies for example."
  4. smalltalk.addMethod(
  5. "__minus_gt",
  6. smalltalk.method({
  7. selector: "->",
  8. category: 'converting',
  9. fn: function (anObject){
  10. var self=this;
  11. return smalltalk.send((smalltalk.Association || Association), "_key_value_", [self, anObject]);
  12. return self;},
  13. args: ["anObject"],
  14. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  15. messageSends: ["key:value:"],
  16. referencedClasses: ["Association"]
  17. }),
  18. smalltalk.Object);
  19. smalltalk.addMethod(
  20. "__eq",
  21. smalltalk.method({
  22. selector: "=",
  23. category: 'comparing',
  24. fn: function (anObject){
  25. var self=this;
  26. return smalltalk.send(self, "__eq_eq", [anObject]);
  27. return self;},
  28. args: ["anObject"],
  29. source: "= anObject\x0a\x09^self == anObject",
  30. messageSends: ["=="],
  31. referencedClasses: []
  32. }),
  33. smalltalk.Object);
  34. smalltalk.addMethod(
  35. "__eq_eq",
  36. smalltalk.method({
  37. selector: "==",
  38. category: 'comparing',
  39. fn: function (anObject){
  40. var self=this;
  41. return smalltalk.send(smalltalk.send(self, "_identityHash", []), "__eq", [smalltalk.send(anObject, "_identityHash", [])]);
  42. return self;},
  43. args: ["anObject"],
  44. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  45. messageSends: ["=", "identityHash"],
  46. referencedClasses: []
  47. }),
  48. smalltalk.Object);
  49. smalltalk.addMethod(
  50. "_asJSON",
  51. smalltalk.method({
  52. selector: "asJSON",
  53. category: 'converting',
  54. fn: function (){
  55. var self=this;
  56. var variables=nil;
  57. (variables=smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_new", []));
  58. smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_allInstanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(variables, "_at_put_", [each, smalltalk.send(smalltalk.send(self, "_instVarAt_", [each]), "_asJSON", [])]);})]);
  59. return variables;
  60. return self;},
  61. args: [],
  62. 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",
  63. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"],
  64. referencedClasses: ["HashedCollection"]
  65. }),
  66. smalltalk.Object);
  67. smalltalk.addMethod(
  68. "_asJSONString",
  69. smalltalk.method({
  70. selector: "asJSONString",
  71. category: 'converting',
  72. fn: function (){
  73. var self=this;
  74. return smalltalk.send((smalltalk.JSON || JSON), "_stringify_", [smalltalk.send(self, "_asJSON", [])]);
  75. return self;},
  76. args: [],
  77. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  78. messageSends: ["stringify:", "asJSON"],
  79. referencedClasses: ["JSON"]
  80. }),
  81. smalltalk.Object);
  82. smalltalk.addMethod(
  83. "_asJavascript",
  84. smalltalk.method({
  85. selector: "asJavascript",
  86. category: 'converting',
  87. fn: function (){
  88. var self=this;
  89. return smalltalk.send(self, "_asString", []);
  90. return self;},
  91. args: [],
  92. source: "asJavascript\x0a\x09^self asString",
  93. messageSends: ["asString"],
  94. referencedClasses: []
  95. }),
  96. smalltalk.Object);
  97. smalltalk.addMethod(
  98. "_asString",
  99. smalltalk.method({
  100. selector: "asString",
  101. category: 'converting',
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.send(self, "_printString", []);
  105. return self;},
  106. args: [],
  107. source: "asString\x0a\x09^self printString",
  108. messageSends: ["printString"],
  109. referencedClasses: []
  110. }),
  111. smalltalk.Object);
  112. smalltalk.addMethod(
  113. "_basicAt_",
  114. smalltalk.method({
  115. selector: "basicAt:",
  116. category: 'accessing',
  117. fn: function (aString){
  118. var self=this;
  119. return self[aString];
  120. return self;},
  121. args: ["aString"],
  122. source: "basicAt: aString\x0a\x09<return self[aString]>",
  123. messageSends: [],
  124. referencedClasses: []
  125. }),
  126. smalltalk.Object);
  127. smalltalk.addMethod(
  128. "_basicAt_put_",
  129. smalltalk.method({
  130. selector: "basicAt:put:",
  131. category: 'accessing',
  132. fn: function (aString, anObject){
  133. var self=this;
  134. return self[aString] = anObject;
  135. return self;},
  136. args: ["aString", "anObject"],
  137. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  138. messageSends: [],
  139. referencedClasses: []
  140. }),
  141. smalltalk.Object);
  142. smalltalk.addMethod(
  143. "_basicDelete_",
  144. smalltalk.method({
  145. selector: "basicDelete:",
  146. category: 'accessing',
  147. fn: function (aString){
  148. var self=this;
  149. delete self[aString]; return aString;
  150. return self;},
  151. args: ["aString"],
  152. source: "basicDelete: aString\x0a <delete self[aString]; return aString>",
  153. messageSends: [],
  154. referencedClasses: []
  155. }),
  156. smalltalk.Object);
  157. smalltalk.addMethod(
  158. "_basicPerform_",
  159. smalltalk.method({
  160. selector: "basicPerform:",
  161. category: 'message handling',
  162. fn: function (aSymbol){
  163. var self=this;
  164. return smalltalk.send(self, "_basicPerform_withArguments_", [aSymbol, []]);
  165. return self;},
  166. args: ["aSymbol"],
  167. source: "basicPerform: aSymbol \x0a\x09^self basicPerform: aSymbol withArguments: #()",
  168. messageSends: ["basicPerform:withArguments:"],
  169. referencedClasses: []
  170. }),
  171. smalltalk.Object);
  172. smalltalk.addMethod(
  173. "_basicPerform_withArguments_",
  174. smalltalk.method({
  175. selector: "basicPerform:withArguments:",
  176. category: 'message handling',
  177. fn: function (aSymbol, aCollection){
  178. var self=this;
  179. return self[aSymbol].apply(self, aCollection);;
  180. return self;},
  181. args: ["aSymbol", "aCollection"],
  182. source: "basicPerform: aSymbol withArguments: aCollection\x0a\x09<return self[aSymbol].apply(self, aCollection);>",
  183. messageSends: [],
  184. referencedClasses: []
  185. }),
  186. smalltalk.Object);
  187. smalltalk.addMethod(
  188. "_class",
  189. smalltalk.method({
  190. selector: "class",
  191. category: 'accessing',
  192. fn: function (){
  193. var self=this;
  194. return self.klass;
  195. return self;},
  196. args: [],
  197. source: "class\x0a\x09<return self.klass>",
  198. messageSends: [],
  199. referencedClasses: []
  200. }),
  201. smalltalk.Object);
  202. smalltalk.addMethod(
  203. "_copy",
  204. smalltalk.method({
  205. selector: "copy",
  206. category: 'copying',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.send(smalltalk.send(self, "_shallowCopy", []), "_postCopy", []);
  210. return self;},
  211. args: [],
  212. source: "copy\x0a\x09^self shallowCopy postCopy",
  213. messageSends: ["postCopy", "shallowCopy"],
  214. referencedClasses: []
  215. }),
  216. smalltalk.Object);
  217. smalltalk.addMethod(
  218. "_deepCopy",
  219. smalltalk.method({
  220. selector: "deepCopy",
  221. category: 'copying',
  222. fn: function (){
  223. var self=this;
  224. var copy = self.klass._new();
  225. for(var i in self) {
  226. if(/^@.+/.test(i)) {
  227. copy[i] = self[i]._deepCopy();
  228. }
  229. }
  230. return copy;
  231. ;
  232. return self;},
  233. args: [],
  234. source: "deepCopy\x0a\x09< \x0a\x09 var copy = self.klass._new();\x0a\x09 for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09 copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09 }\x0a\x09 return copy;\x0a\x09>",
  235. messageSends: [],
  236. referencedClasses: []
  237. }),
  238. smalltalk.Object);
  239. smalltalk.addMethod(
  240. "_deprecatedAPI",
  241. smalltalk.method({
  242. selector: "deprecatedAPI",
  243. category: 'error handling',
  244. fn: function (){
  245. var self=this;
  246. smalltalk.send((typeof console == 'undefined' ? nil : console), "_warn_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.getThisContext()), "_home", []), "_asString", []), "__comma", [" is deprecated! (in "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.getThisContext()), "_home", []), "_home", []), "_asString", [])]), "__comma", [")"])]);
  247. return self;},
  248. args: [],
  249. 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, ')'",
  250. messageSends: ["warn:", ",", "asString", "home"],
  251. referencedClasses: []
  252. }),
  253. smalltalk.Object);
  254. smalltalk.addMethod(
  255. "_doesNotUnderstand_",
  256. smalltalk.method({
  257. selector: "doesNotUnderstand:",
  258. category: 'error handling',
  259. fn: function (aMessage){
  260. var self=this;
  261. (function($rec){smalltalk.send($rec, "_receiver_", [self]);smalltalk.send($rec, "_message_", [aMessage]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.MessageNotUnderstood || MessageNotUnderstood), "_new", []));
  262. return self;},
  263. args: ["aMessage"],
  264. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  265. messageSends: ["receiver:", "message:", "signal", "new"],
  266. referencedClasses: ["MessageNotUnderstood"]
  267. }),
  268. smalltalk.Object);
  269. smalltalk.addMethod(
  270. "_error_",
  271. smalltalk.method({
  272. selector: "error:",
  273. category: 'error handling',
  274. fn: function (aString){
  275. var self=this;
  276. smalltalk.send((smalltalk.Error || Error), "_signal_", [aString]);
  277. return self;},
  278. args: ["aString"],
  279. source: "error: aString\x0a\x09Error signal: aString",
  280. messageSends: ["signal:"],
  281. referencedClasses: ["Error"]
  282. }),
  283. smalltalk.Object);
  284. smalltalk.addMethod(
  285. "_halt",
  286. smalltalk.method({
  287. selector: "halt",
  288. category: 'error handling',
  289. fn: function (){
  290. var self=this;
  291. smalltalk.send(self, "_error_", ["Halt encountered"]);
  292. return self;},
  293. args: [],
  294. source: "halt\x0a\x09self error: 'Halt encountered'",
  295. messageSends: ["error:"],
  296. referencedClasses: []
  297. }),
  298. smalltalk.Object);
  299. smalltalk.addMethod(
  300. "_identityHash",
  301. smalltalk.method({
  302. selector: "identityHash",
  303. category: 'accessing',
  304. fn: function (){
  305. var self=this;
  306. var hash=self.identityHash;
  307. if (hash) return hash;
  308. hash=smalltalk.nextId();
  309. Object.defineProperty(self, 'identityHash', {value:hash});
  310. return hash;
  311. ;
  312. return self;},
  313. args: [],
  314. 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>",
  315. messageSends: [],
  316. referencedClasses: []
  317. }),
  318. smalltalk.Object);
  319. smalltalk.addMethod(
  320. "_ifNil_",
  321. smalltalk.method({
  322. selector: "ifNil:",
  323. category: 'testing',
  324. fn: function (aBlock){
  325. var self=this;
  326. return self;
  327. return self;},
  328. args: ["aBlock"],
  329. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  330. messageSends: [],
  331. referencedClasses: []
  332. }),
  333. smalltalk.Object);
  334. smalltalk.addMethod(
  335. "_ifNil_ifNotNil_",
  336. smalltalk.method({
  337. selector: "ifNil:ifNotNil:",
  338. category: 'testing',
  339. fn: function (aBlock, anotherBlock){
  340. var self=this;
  341. return smalltalk.send(anotherBlock, "_value", []);
  342. return self;},
  343. args: ["aBlock", "anotherBlock"],
  344. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  345. messageSends: ["value"],
  346. referencedClasses: []
  347. }),
  348. smalltalk.Object);
  349. smalltalk.addMethod(
  350. "_ifNotNil_",
  351. smalltalk.method({
  352. selector: "ifNotNil:",
  353. category: 'testing',
  354. fn: function (aBlock){
  355. var self=this;
  356. return smalltalk.send(aBlock, "_value", []);
  357. return self;},
  358. args: ["aBlock"],
  359. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  360. messageSends: ["value"],
  361. referencedClasses: []
  362. }),
  363. smalltalk.Object);
  364. smalltalk.addMethod(
  365. "_ifNotNil_ifNil_",
  366. smalltalk.method({
  367. selector: "ifNotNil:ifNil:",
  368. category: 'testing',
  369. fn: function (aBlock, anotherBlock){
  370. var self=this;
  371. return smalltalk.send(aBlock, "_value", []);
  372. return self;},
  373. args: ["aBlock", "anotherBlock"],
  374. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  375. messageSends: ["value"],
  376. referencedClasses: []
  377. }),
  378. smalltalk.Object);
  379. smalltalk.addMethod(
  380. "_initialize",
  381. smalltalk.method({
  382. selector: "initialize",
  383. category: 'initialization',
  384. fn: function (){
  385. var self=this;
  386. return self;},
  387. args: [],
  388. source: "initialize",
  389. messageSends: [],
  390. referencedClasses: []
  391. }),
  392. smalltalk.Object);
  393. smalltalk.addMethod(
  394. "_instVarAt_",
  395. smalltalk.method({
  396. selector: "instVarAt:",
  397. category: 'accessing',
  398. fn: function (aSymbol){
  399. var self=this;
  400. var varname=nil;
  401. (varname=smalltalk.send(aSymbol, "_asString", []));
  402. return self['@'+varname];
  403. return self;},
  404. args: ["aSymbol"],
  405. source: "instVarAt: aSymbol\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<return self['@'+varname]>",
  406. messageSends: ["asString"],
  407. referencedClasses: []
  408. }),
  409. smalltalk.Object);
  410. smalltalk.addMethod(
  411. "_instVarAt_put_",
  412. smalltalk.method({
  413. selector: "instVarAt:put:",
  414. category: 'accessing',
  415. fn: function (aSymbol, anObject){
  416. var self=this;
  417. var varname=nil;
  418. (varname=smalltalk.send(aSymbol, "_asString", []));
  419. self['@' + varname] = anObject;
  420. return self;},
  421. args: ["aSymbol", "anObject"],
  422. source: "instVarAt: aSymbol put: anObject\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<self['@' + varname] = anObject>",
  423. messageSends: ["asString"],
  424. referencedClasses: []
  425. }),
  426. smalltalk.Object);
  427. smalltalk.addMethod(
  428. "_isClass",
  429. smalltalk.method({
  430. selector: "isClass",
  431. category: 'testing',
  432. fn: function (){
  433. var self=this;
  434. return false;
  435. return self;},
  436. args: [],
  437. source: "isClass\x0a\x09^false",
  438. messageSends: [],
  439. referencedClasses: []
  440. }),
  441. smalltalk.Object);
  442. smalltalk.addMethod(
  443. "_isKindOf_",
  444. smalltalk.method({
  445. selector: "isKindOf:",
  446. category: 'testing',
  447. fn: function (aClass){
  448. var self=this;
  449. return ((($receiver = smalltalk.send(self, "_isMemberOf_", [aClass])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return true;})() : (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return true;}), (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);})]));
  450. return self;},
  451. args: ["aClass"],
  452. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: [self class inheritsFrom: aClass]",
  453. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
  454. referencedClasses: []
  455. }),
  456. smalltalk.Object);
  457. smalltalk.addMethod(
  458. "_isMemberOf_",
  459. smalltalk.method({
  460. selector: "isMemberOf:",
  461. category: 'testing',
  462. fn: function (aClass){
  463. var self=this;
  464. return smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [aClass]);
  465. return self;},
  466. args: ["aClass"],
  467. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  468. messageSends: ["=", "class"],
  469. referencedClasses: []
  470. }),
  471. smalltalk.Object);
  472. smalltalk.addMethod(
  473. "_isMetaclass",
  474. smalltalk.method({
  475. selector: "isMetaclass",
  476. category: 'testing',
  477. fn: function (){
  478. var self=this;
  479. return false;
  480. return self;},
  481. args: [],
  482. source: "isMetaclass\x0a\x09^false",
  483. messageSends: [],
  484. referencedClasses: []
  485. }),
  486. smalltalk.Object);
  487. smalltalk.addMethod(
  488. "_isNil",
  489. smalltalk.method({
  490. selector: "isNil",
  491. category: 'testing',
  492. fn: function (){
  493. var self=this;
  494. return false;
  495. return self;},
  496. args: [],
  497. source: "isNil\x0a\x09^false",
  498. messageSends: [],
  499. referencedClasses: []
  500. }),
  501. smalltalk.Object);
  502. smalltalk.addMethod(
  503. "_isNumber",
  504. smalltalk.method({
  505. selector: "isNumber",
  506. category: 'testing',
  507. fn: function (){
  508. var self=this;
  509. return false;
  510. return self;},
  511. args: [],
  512. source: "isNumber\x0a\x09^false",
  513. messageSends: [],
  514. referencedClasses: []
  515. }),
  516. smalltalk.Object);
  517. smalltalk.addMethod(
  518. "_isParseFailure",
  519. smalltalk.method({
  520. selector: "isParseFailure",
  521. category: 'testing',
  522. fn: function (){
  523. var self=this;
  524. return false;
  525. return self;},
  526. args: [],
  527. source: "isParseFailure\x0a\x09^false",
  528. messageSends: [],
  529. referencedClasses: []
  530. }),
  531. smalltalk.Object);
  532. smalltalk.addMethod(
  533. "_isString",
  534. smalltalk.method({
  535. selector: "isString",
  536. category: 'testing',
  537. fn: function (){
  538. var self=this;
  539. return false;
  540. return self;},
  541. args: [],
  542. source: "isString\x0a\x09^false",
  543. messageSends: [],
  544. referencedClasses: []
  545. }),
  546. smalltalk.Object);
  547. smalltalk.addMethod(
  548. "_isSymbol",
  549. smalltalk.method({
  550. selector: "isSymbol",
  551. category: 'testing',
  552. fn: function (){
  553. var self=this;
  554. return false;
  555. return self;},
  556. args: [],
  557. source: "isSymbol\x0a\x09^false",
  558. messageSends: [],
  559. referencedClasses: []
  560. }),
  561. smalltalk.Object);
  562. smalltalk.addMethod(
  563. "_log_block_",
  564. smalltalk.method({
  565. selector: "log:block:",
  566. category: 'printing',
  567. fn: function (aString, aBlock){
  568. var self=this;
  569. var result=nil;
  570. smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(smalltalk.send(aString, "__comma", [" time: "]), "__comma", [smalltalk.send(smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [(function(){return (result=smalltalk.send(aBlock, "_value", []));})]), "_printString", [])])]);
  571. return result;
  572. return self;},
  573. args: ["aString", "aBlock"],
  574. source: "log: aString block: aBlock\x0a\x0a\x09| result |\x0a\x09console log: aString, ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.\x0a\x09^result",
  575. messageSends: ["log:", ",", "printString", "millisecondsToRun:", "value"],
  576. referencedClasses: ["Date"]
  577. }),
  578. smalltalk.Object);
  579. smalltalk.addMethod(
  580. "_notNil",
  581. smalltalk.method({
  582. selector: "notNil",
  583. category: 'testing',
  584. fn: function (){
  585. var self=this;
  586. return smalltalk.send(smalltalk.send(self, "_isNil", []), "_not", []);
  587. return self;},
  588. args: [],
  589. source: "notNil\x0a\x09^self isNil not",
  590. messageSends: ["not", "isNil"],
  591. referencedClasses: []
  592. }),
  593. smalltalk.Object);
  594. smalltalk.addMethod(
  595. "_perform_",
  596. smalltalk.method({
  597. selector: "perform:",
  598. category: 'message handling',
  599. fn: function (aSymbol){
  600. var self=this;
  601. return smalltalk.send(self, "_perform_withArguments_", [aSymbol, []]);
  602. return self;},
  603. args: ["aSymbol"],
  604. source: "perform: aSymbol\x0a\x09^self perform: aSymbol withArguments: #()",
  605. messageSends: ["perform:withArguments:"],
  606. referencedClasses: []
  607. }),
  608. smalltalk.Object);
  609. smalltalk.addMethod(
  610. "_perform_withArguments_",
  611. smalltalk.method({
  612. selector: "perform:withArguments:",
  613. category: 'message handling',
  614. fn: function (aSymbol, aCollection){
  615. var self=this;
  616. var selector=nil;
  617. (selector=smalltalk.send(aSymbol, "_asSelector", []));
  618. return smalltalk.send(self, selector, aCollection);
  619. return self;},
  620. args: ["aSymbol", "aCollection"],
  621. source: "perform: aSymbol withArguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSymbol asSelector.\x0a\x09<return smalltalk.send(self, selector, aCollection)>",
  622. messageSends: ["asSelector"],
  623. referencedClasses: []
  624. }),
  625. smalltalk.Object);
  626. smalltalk.addMethod(
  627. "_postCopy",
  628. smalltalk.method({
  629. selector: "postCopy",
  630. category: 'copying',
  631. fn: function (){
  632. var self=this;
  633. return self;},
  634. args: [],
  635. source: "postCopy",
  636. messageSends: [],
  637. referencedClasses: []
  638. }),
  639. smalltalk.Object);
  640. smalltalk.addMethod(
  641. "_printNl",
  642. smalltalk.method({
  643. selector: "printNl",
  644. category: 'printing',
  645. fn: function (){
  646. var self=this;
  647. console.log(self);
  648. return self;},
  649. args: [],
  650. source: "printNl\x0a\x09<console.log(self)>",
  651. messageSends: [],
  652. referencedClasses: []
  653. }),
  654. smalltalk.Object);
  655. smalltalk.addMethod(
  656. "_printString",
  657. smalltalk.method({
  658. selector: "printString",
  659. category: 'printing',
  660. fn: function (){
  661. var self=this;
  662. return smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]);
  663. return self;},
  664. args: [],
  665. source: "printString\x0a\x09^'a ', self class name",
  666. messageSends: [",", "name", "class"],
  667. referencedClasses: []
  668. }),
  669. smalltalk.Object);
  670. smalltalk.addMethod(
  671. "_respondsTo_",
  672. smalltalk.method({
  673. selector: "respondsTo:",
  674. category: 'testing',
  675. fn: function (aSelector){
  676. var self=this;
  677. return smalltalk.send(smalltalk.send(self, "_class", []), "_canUnderstand_", [aSelector]);
  678. return self;},
  679. args: ["aSelector"],
  680. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  681. messageSends: ["canUnderstand:", "class"],
  682. referencedClasses: []
  683. }),
  684. smalltalk.Object);
  685. smalltalk.addMethod(
  686. "_shallowCopy",
  687. smalltalk.method({
  688. selector: "shallowCopy",
  689. category: 'copying',
  690. fn: function (){
  691. var self=this;
  692. var copy = self.klass._new();
  693. for(var i in self) {
  694. if(/^@.+/.test(i)) {
  695. copy[i] = self[i];
  696. }
  697. }
  698. return copy;
  699. ;
  700. return self;},
  701. args: [],
  702. source: "shallowCopy\x0a\x09<\x0a\x09 var copy = self.klass._new();\x0a\x09 for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09 copy[i] = self[i];\x0a\x09\x09}\x0a\x09 }\x0a\x09 return copy;\x0a\x09>",
  703. messageSends: [],
  704. referencedClasses: []
  705. }),
  706. smalltalk.Object);
  707. smalltalk.addMethod(
  708. "_shouldNotImplement",
  709. smalltalk.method({
  710. selector: "shouldNotImplement",
  711. category: 'error handling',
  712. fn: function (){
  713. var self=this;
  714. smalltalk.send(self, "_error_", [smalltalk.send("This method should not be implemented in ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])])]);
  715. return self;},
  716. args: [],
  717. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  718. messageSends: ["error:", ",", "name", "class"],
  719. referencedClasses: []
  720. }),
  721. smalltalk.Object);
  722. smalltalk.addMethod(
  723. "_size",
  724. smalltalk.method({
  725. selector: "size",
  726. category: 'accessing',
  727. fn: function (){
  728. var self=this;
  729. smalltalk.send(self, "_error_", ["Object not indexable"]);
  730. return self;},
  731. args: [],
  732. source: "size\x0a\x09self error: 'Object not indexable'",
  733. messageSends: ["error:"],
  734. referencedClasses: []
  735. }),
  736. smalltalk.Object);
  737. smalltalk.addMethod(
  738. "_storeOn_",
  739. smalltalk.method({
  740. selector: "storeOn:",
  741. category: 'printing',
  742. fn: function (aStream){
  743. var self=this;
  744. smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [])]);
  745. return self;},
  746. args: ["aStream"],
  747. source: "storeOn: aStream\x0a\x09aStream nextPutAll: self printString",
  748. messageSends: ["nextPutAll:", "printString"],
  749. referencedClasses: []
  750. }),
  751. smalltalk.Object);
  752. smalltalk.addMethod(
  753. "_storeString",
  754. smalltalk.method({
  755. selector: "storeString",
  756. category: 'printing',
  757. fn: function (){
  758. var self=this;
  759. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(s){return smalltalk.send(self, "_storeOn_", [s]);})]);
  760. return self;},
  761. args: [],
  762. source: "storeString\x0a\x09\x22Answer a String representation of the receiver from which the receiver \x0a\x09can be reconstructed.\x22\x0a\x0a\x09^ String streamContents: [:s | self storeOn: s]",
  763. messageSends: ["streamContents:", "storeOn:"],
  764. referencedClasses: ["String"]
  765. }),
  766. smalltalk.Object);
  767. smalltalk.addMethod(
  768. "_subclassResponsibility",
  769. smalltalk.method({
  770. selector: "subclassResponsibility",
  771. category: 'error handling',
  772. fn: function (){
  773. var self=this;
  774. smalltalk.send(self, "_error_", ["This method is a responsibility of a subclass"]);
  775. return self;},
  776. args: [],
  777. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  778. messageSends: ["error:"],
  779. referencedClasses: []
  780. }),
  781. smalltalk.Object);
  782. smalltalk.addMethod(
  783. "_try_catch_",
  784. smalltalk.method({
  785. selector: "try:catch:",
  786. category: 'error handling',
  787. fn: function (aBlock, anotherBlock){
  788. var self=this;
  789. try{result = aBlock()} catch(e) {result = anotherBlock(e)};
  790. return result;;
  791. return self;},
  792. args: ["aBlock", "anotherBlock"],
  793. source: "try: aBlock catch: anotherBlock\x0a\x09<try{result = aBlock()} catch(e) {result = anotherBlock(e)};\x0a\x09return result;>",
  794. messageSends: [],
  795. referencedClasses: []
  796. }),
  797. smalltalk.Object);
  798. smalltalk.addMethod(
  799. "_yourself",
  800. smalltalk.method({
  801. selector: "yourself",
  802. category: 'accessing',
  803. fn: function (){
  804. var self=this;
  805. return self;
  806. return self;},
  807. args: [],
  808. source: "yourself\x0a\x09^self",
  809. messageSends: [],
  810. referencedClasses: []
  811. }),
  812. smalltalk.Object);
  813. smalltalk.addMethod(
  814. "_~_eq",
  815. smalltalk.method({
  816. selector: "~=",
  817. category: 'comparing',
  818. fn: function (anObject){
  819. var self=this;
  820. return smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq", [false]);
  821. return self;},
  822. args: ["anObject"],
  823. source: "~= anObject\x0a\x09^(self = anObject) = false",
  824. messageSends: ["="],
  825. referencedClasses: []
  826. }),
  827. smalltalk.Object);
  828. smalltalk.addMethod(
  829. "_~~",
  830. smalltalk.method({
  831. selector: "~~",
  832. category: 'comparing',
  833. fn: function (anObject){
  834. var self=this;
  835. return smalltalk.send(smalltalk.send(self, "__eq_eq", [anObject]), "__eq", [false]);
  836. return self;},
  837. args: ["anObject"],
  838. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  839. messageSends: ["=", "=="],
  840. referencedClasses: []
  841. }),
  842. smalltalk.Object);
  843. smalltalk.addMethod(
  844. "_initialize",
  845. smalltalk.method({
  846. selector: "initialize",
  847. category: 'initialization',
  848. fn: function (){
  849. var self=this;
  850. return self;},
  851. args: [],
  852. source: "initialize\x0a\x09\x22no op\x22",
  853. messageSends: [],
  854. referencedClasses: []
  855. }),
  856. smalltalk.Object.klass);
  857. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  858. 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`."
  859. smalltalk.addMethod(
  860. "_&",
  861. smalltalk.method({
  862. selector: "&",
  863. category: 'controlling',
  864. fn: function (aBoolean){
  865. var self=this;
  866. if(self == true) {
  867. return aBoolean;
  868. } else {
  869. return false;
  870. }
  871. ;
  872. return self;},
  873. args: ["aBoolean"],
  874. source: "& aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09 } else {\x0a\x09\x09return false;\x0a\x09 }\x0a\x09>",
  875. messageSends: [],
  876. referencedClasses: []
  877. }),
  878. smalltalk.Boolean);
  879. smalltalk.addMethod(
  880. "__eq",
  881. smalltalk.method({
  882. selector: "=",
  883. category: 'comparing',
  884. fn: function (aBoolean){
  885. var self=this;
  886. var $early={};
  887. try{((($receiver = smalltalk.send(smalltalk.send(aBoolean, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  888. return Boolean(self == true) == aBoolean;
  889. return self;
  890. } catch(e) {if(e===$early)return e[0]; throw e}},
  891. args: ["aBoolean"],
  892. source: "= aBoolean\x0a\x09aBoolean class = self class ifFalse: [^false].\x0a\x09<return Boolean(self == true) == aBoolean>",
  893. messageSends: ["ifFalse:", "=", "class"],
  894. referencedClasses: []
  895. }),
  896. smalltalk.Boolean);
  897. smalltalk.addMethod(
  898. "__eq_eq",
  899. smalltalk.method({
  900. selector: "==",
  901. category: 'comparing',
  902. fn: function (aBoolean){
  903. var self=this;
  904. return smalltalk.send(self, "__eq", [aBoolean]);
  905. return self;},
  906. args: ["aBoolean"],
  907. source: "== aBoolean\x0a\x09^self = aBoolean",
  908. messageSends: ["="],
  909. referencedClasses: []
  910. }),
  911. smalltalk.Boolean);
  912. smalltalk.addMethod(
  913. "_and_",
  914. smalltalk.method({
  915. selector: "and:",
  916. category: 'controlling',
  917. fn: function (aBlock){
  918. var self=this;
  919. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [aBlock, (function(){return false;})]);
  920. return self;},
  921. args: ["aBlock"],
  922. source: "and: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: aBlock\x0a\x09 ifFalse: [false]",
  923. messageSends: ["ifTrue:ifFalse:", "="],
  924. referencedClasses: []
  925. }),
  926. smalltalk.Boolean);
  927. smalltalk.addMethod(
  928. "_asJSON",
  929. smalltalk.method({
  930. selector: "asJSON",
  931. category: 'converting',
  932. fn: function (){
  933. var self=this;
  934. return self;
  935. return self;},
  936. args: [],
  937. source: "asJSON\x0a\x09^self",
  938. messageSends: [],
  939. referencedClasses: []
  940. }),
  941. smalltalk.Boolean);
  942. smalltalk.addMethod(
  943. "_deepCopy",
  944. smalltalk.method({
  945. selector: "deepCopy",
  946. category: 'copying',
  947. fn: function (){
  948. var self=this;
  949. return self;
  950. return self;},
  951. args: [],
  952. source: "deepCopy\x0a\x09^self",
  953. messageSends: [],
  954. referencedClasses: []
  955. }),
  956. smalltalk.Boolean);
  957. smalltalk.addMethod(
  958. "_ifFalse_",
  959. smalltalk.method({
  960. selector: "ifFalse:",
  961. category: 'controlling',
  962. fn: function (aBlock){
  963. var self=this;
  964. return smalltalk.send(self, "_ifTrue_ifFalse_", [(function(){return nil;}), aBlock]);
  965. return self;},
  966. args: ["aBlock"],
  967. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  968. messageSends: ["ifTrue:ifFalse:"],
  969. referencedClasses: []
  970. }),
  971. smalltalk.Boolean);
  972. smalltalk.addMethod(
  973. "_ifFalse_ifTrue_",
  974. smalltalk.method({
  975. selector: "ifFalse:ifTrue:",
  976. category: 'controlling',
  977. fn: function (aBlock, anotherBlock){
  978. var self=this;
  979. return smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  980. return self;},
  981. args: ["aBlock", "anotherBlock"],
  982. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  983. messageSends: ["ifTrue:ifFalse:"],
  984. referencedClasses: []
  985. }),
  986. smalltalk.Boolean);
  987. smalltalk.addMethod(
  988. "_ifTrue_",
  989. smalltalk.method({
  990. selector: "ifTrue:",
  991. category: 'controlling',
  992. fn: function (aBlock){
  993. var self=this;
  994. return smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, (function(){return nil;})]);
  995. return self;},
  996. args: ["aBlock"],
  997. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  998. messageSends: ["ifTrue:ifFalse:"],
  999. referencedClasses: []
  1000. }),
  1001. smalltalk.Boolean);
  1002. smalltalk.addMethod(
  1003. "_ifTrue_ifFalse_",
  1004. smalltalk.method({
  1005. selector: "ifTrue:ifFalse:",
  1006. category: 'controlling',
  1007. fn: function (aBlock, anotherBlock){
  1008. var self=this;
  1009. if(self == true) {
  1010. return aBlock();
  1011. } else {
  1012. return anotherBlock();
  1013. }
  1014. ;
  1015. return self;},
  1016. args: ["aBlock", "anotherBlock"],
  1017. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBlock();\x0a\x09 } else {\x0a\x09\x09return anotherBlock();\x0a\x09 }\x0a\x09>",
  1018. messageSends: [],
  1019. referencedClasses: []
  1020. }),
  1021. smalltalk.Boolean);
  1022. smalltalk.addMethod(
  1023. "_not",
  1024. smalltalk.method({
  1025. selector: "not",
  1026. category: 'controlling',
  1027. fn: function (){
  1028. var self=this;
  1029. return smalltalk.send(self, "__eq", [false]);
  1030. return self;},
  1031. args: [],
  1032. source: "not\x0a\x09^self = false",
  1033. messageSends: ["="],
  1034. referencedClasses: []
  1035. }),
  1036. smalltalk.Boolean);
  1037. smalltalk.addMethod(
  1038. "_or_",
  1039. smalltalk.method({
  1040. selector: "or:",
  1041. category: 'controlling',
  1042. fn: function (aBlock){
  1043. var self=this;
  1044. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [(function(){return true;}), aBlock]);
  1045. return self;},
  1046. args: ["aBlock"],
  1047. source: "or: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: aBlock",
  1048. messageSends: ["ifTrue:ifFalse:", "="],
  1049. referencedClasses: []
  1050. }),
  1051. smalltalk.Boolean);
  1052. smalltalk.addMethod(
  1053. "_printString",
  1054. smalltalk.method({
  1055. selector: "printString",
  1056. category: 'printing',
  1057. fn: function (){
  1058. var self=this;
  1059. return self.toString();
  1060. return self;},
  1061. args: [],
  1062. source: "printString\x0a\x09<return self.toString()>",
  1063. messageSends: [],
  1064. referencedClasses: []
  1065. }),
  1066. smalltalk.Boolean);
  1067. smalltalk.addMethod(
  1068. "_shallowCopy",
  1069. smalltalk.method({
  1070. selector: "shallowCopy",
  1071. category: 'copying',
  1072. fn: function (){
  1073. var self=this;
  1074. return self;
  1075. return self;},
  1076. args: [],
  1077. source: "shallowCopy\x0a\x09^self",
  1078. messageSends: [],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.Boolean);
  1082. smalltalk.addMethod(
  1083. "_|",
  1084. smalltalk.method({
  1085. selector: "|",
  1086. category: 'controlling',
  1087. fn: function (aBoolean){
  1088. var self=this;
  1089. if(self == true) {
  1090. return true;
  1091. } else {
  1092. return aBoolean;
  1093. }
  1094. ;
  1095. return self;},
  1096. args: ["aBoolean"],
  1097. source: "| aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return true;\x0a\x09 } else {\x0a\x09\x09return aBoolean;\x0a\x09 }\x0a\x09>",
  1098. messageSends: [],
  1099. referencedClasses: []
  1100. }),
  1101. smalltalk.Boolean);
  1102. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1103. 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."
  1104. smalltalk.addMethod(
  1105. "__plus",
  1106. smalltalk.method({
  1107. selector: "+",
  1108. category: 'arithmetic',
  1109. fn: function (aDate){
  1110. var self=this;
  1111. return self + aDate;
  1112. return self;},
  1113. args: ["aDate"],
  1114. source: "+ aDate\x0a\x09<return self + aDate>",
  1115. messageSends: [],
  1116. referencedClasses: []
  1117. }),
  1118. smalltalk.Date);
  1119. smalltalk.addMethod(
  1120. "__minus",
  1121. smalltalk.method({
  1122. selector: "-",
  1123. category: 'arithmetic',
  1124. fn: function (aDate){
  1125. var self=this;
  1126. return self - aDate;
  1127. return self;},
  1128. args: ["aDate"],
  1129. source: "- aDate\x0a\x09<return self - aDate>",
  1130. messageSends: [],
  1131. referencedClasses: []
  1132. }),
  1133. smalltalk.Date);
  1134. smalltalk.addMethod(
  1135. "__lt",
  1136. smalltalk.method({
  1137. selector: "<",
  1138. category: 'comparing',
  1139. fn: function (aDate){
  1140. var self=this;
  1141. return self < aDate;
  1142. return self;},
  1143. args: ["aDate"],
  1144. source: "< aDate\x0a\x09<return self < aDate>",
  1145. messageSends: [],
  1146. referencedClasses: []
  1147. }),
  1148. smalltalk.Date);
  1149. smalltalk.addMethod(
  1150. "__lt_eq",
  1151. smalltalk.method({
  1152. selector: "<=",
  1153. category: 'comparing',
  1154. fn: function (aDate){
  1155. var self=this;
  1156. return self <= aDate;
  1157. return self;},
  1158. args: ["aDate"],
  1159. source: "<= aDate\x0a\x09<return self <= aDate>",
  1160. messageSends: [],
  1161. referencedClasses: []
  1162. }),
  1163. smalltalk.Date);
  1164. smalltalk.addMethod(
  1165. "__gt",
  1166. smalltalk.method({
  1167. selector: ">",
  1168. category: 'comparing',
  1169. fn: function (aDate){
  1170. var self=this;
  1171. return self > aDate;
  1172. return self;},
  1173. args: ["aDate"],
  1174. source: "> aDate\x0a\x09<return self >> aDate>",
  1175. messageSends: [],
  1176. referencedClasses: []
  1177. }),
  1178. smalltalk.Date);
  1179. smalltalk.addMethod(
  1180. "__gt_eq",
  1181. smalltalk.method({
  1182. selector: ">=",
  1183. category: 'comparing',
  1184. fn: function (aDate){
  1185. var self=this;
  1186. return self >= aDate;
  1187. return self;},
  1188. args: ["aDate"],
  1189. source: ">= aDate\x0a\x09<return self >>= aDate>",
  1190. messageSends: [],
  1191. referencedClasses: []
  1192. }),
  1193. smalltalk.Date);
  1194. smalltalk.addMethod(
  1195. "_asDateString",
  1196. smalltalk.method({
  1197. selector: "asDateString",
  1198. category: 'converting',
  1199. fn: function (){
  1200. var self=this;
  1201. return self.toDateString();
  1202. return self;},
  1203. args: [],
  1204. source: "asDateString\x0a\x09<return self.toDateString()>",
  1205. messageSends: [],
  1206. referencedClasses: []
  1207. }),
  1208. smalltalk.Date);
  1209. smalltalk.addMethod(
  1210. "_asLocaleString",
  1211. smalltalk.method({
  1212. selector: "asLocaleString",
  1213. category: 'converting',
  1214. fn: function (){
  1215. var self=this;
  1216. return self.toLocaleString();
  1217. return self;},
  1218. args: [],
  1219. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  1220. messageSends: [],
  1221. referencedClasses: []
  1222. }),
  1223. smalltalk.Date);
  1224. smalltalk.addMethod(
  1225. "_asMilliseconds",
  1226. smalltalk.method({
  1227. selector: "asMilliseconds",
  1228. category: 'converting',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.send(self, "_time", []);
  1232. return self;},
  1233. args: [],
  1234. source: "asMilliseconds\x0a\x09^self time",
  1235. messageSends: ["time"],
  1236. referencedClasses: []
  1237. }),
  1238. smalltalk.Date);
  1239. smalltalk.addMethod(
  1240. "_asNumber",
  1241. smalltalk.method({
  1242. selector: "asNumber",
  1243. category: 'converting',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.send(self, "_asMilliseconds", []);
  1247. return self;},
  1248. args: [],
  1249. source: "asNumber\x0a\x09^self asMilliseconds",
  1250. messageSends: ["asMilliseconds"],
  1251. referencedClasses: []
  1252. }),
  1253. smalltalk.Date);
  1254. smalltalk.addMethod(
  1255. "_asString",
  1256. smalltalk.method({
  1257. selector: "asString",
  1258. category: 'converting',
  1259. fn: function (){
  1260. var self=this;
  1261. return self.toString();
  1262. return self;},
  1263. args: [],
  1264. source: "asString\x0a\x09<return self.toString()>",
  1265. messageSends: [],
  1266. referencedClasses: []
  1267. }),
  1268. smalltalk.Date);
  1269. smalltalk.addMethod(
  1270. "_asTimeString",
  1271. smalltalk.method({
  1272. selector: "asTimeString",
  1273. category: 'converting',
  1274. fn: function (){
  1275. var self=this;
  1276. return self.toTimeString();
  1277. return self;},
  1278. args: [],
  1279. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  1280. messageSends: [],
  1281. referencedClasses: []
  1282. }),
  1283. smalltalk.Date);
  1284. smalltalk.addMethod(
  1285. "_day",
  1286. smalltalk.method({
  1287. selector: "day",
  1288. category: 'accessing',
  1289. fn: function (){
  1290. var self=this;
  1291. return smalltalk.send(self, "_dayOfWeek", []);
  1292. return self;},
  1293. args: [],
  1294. source: "day\x0a\x09^self dayOfWeek",
  1295. messageSends: ["dayOfWeek"],
  1296. referencedClasses: []
  1297. }),
  1298. smalltalk.Date);
  1299. smalltalk.addMethod(
  1300. "_day_",
  1301. smalltalk.method({
  1302. selector: "day:",
  1303. category: 'accessing',
  1304. fn: function (aNumber){
  1305. var self=this;
  1306. smalltalk.send(self, "_dayOfWeek_", [aNumber]);
  1307. return self;},
  1308. args: ["aNumber"],
  1309. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  1310. messageSends: ["dayOfWeek:"],
  1311. referencedClasses: []
  1312. }),
  1313. smalltalk.Date);
  1314. smalltalk.addMethod(
  1315. "_dayOfMonth",
  1316. smalltalk.method({
  1317. selector: "dayOfMonth",
  1318. category: 'accessing',
  1319. fn: function (){
  1320. var self=this;
  1321. return self.getDate();
  1322. return self;},
  1323. args: [],
  1324. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  1325. messageSends: [],
  1326. referencedClasses: []
  1327. }),
  1328. smalltalk.Date);
  1329. smalltalk.addMethod(
  1330. "_dayOfMonth_",
  1331. smalltalk.method({
  1332. selector: "dayOfMonth:",
  1333. category: 'accessing',
  1334. fn: function (aNumber){
  1335. var self=this;
  1336. self.setDate(aNumber);
  1337. return self;},
  1338. args: ["aNumber"],
  1339. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  1340. messageSends: [],
  1341. referencedClasses: []
  1342. }),
  1343. smalltalk.Date);
  1344. smalltalk.addMethod(
  1345. "_dayOfWeek",
  1346. smalltalk.method({
  1347. selector: "dayOfWeek",
  1348. category: 'accessing',
  1349. fn: function (){
  1350. var self=this;
  1351. return self.getDay() + 1;
  1352. return self;},
  1353. args: [],
  1354. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  1355. messageSends: [],
  1356. referencedClasses: []
  1357. }),
  1358. smalltalk.Date);
  1359. smalltalk.addMethod(
  1360. "_dayOfWeek_",
  1361. smalltalk.method({
  1362. selector: "dayOfWeek:",
  1363. category: 'accessing',
  1364. fn: function (aNumber){
  1365. var self=this;
  1366. return self.setDay(aNumber - 1);
  1367. return self;},
  1368. args: ["aNumber"],
  1369. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  1370. messageSends: [],
  1371. referencedClasses: []
  1372. }),
  1373. smalltalk.Date);
  1374. smalltalk.addMethod(
  1375. "_hours",
  1376. smalltalk.method({
  1377. selector: "hours",
  1378. category: 'accessing',
  1379. fn: function (){
  1380. var self=this;
  1381. return self.getHours();
  1382. return self;},
  1383. args: [],
  1384. source: "hours\x0a\x09<return self.getHours()>",
  1385. messageSends: [],
  1386. referencedClasses: []
  1387. }),
  1388. smalltalk.Date);
  1389. smalltalk.addMethod(
  1390. "_hours_",
  1391. smalltalk.method({
  1392. selector: "hours:",
  1393. category: 'accessing',
  1394. fn: function (aNumber){
  1395. var self=this;
  1396. self.setHours(aNumber);
  1397. return self;},
  1398. args: ["aNumber"],
  1399. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  1400. messageSends: [],
  1401. referencedClasses: []
  1402. }),
  1403. smalltalk.Date);
  1404. smalltalk.addMethod(
  1405. "_milliseconds",
  1406. smalltalk.method({
  1407. selector: "milliseconds",
  1408. category: 'accessing',
  1409. fn: function (){
  1410. var self=this;
  1411. return self.getMilliseconds();
  1412. return self;},
  1413. args: [],
  1414. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  1415. messageSends: [],
  1416. referencedClasses: []
  1417. }),
  1418. smalltalk.Date);
  1419. smalltalk.addMethod(
  1420. "_milliseconds_",
  1421. smalltalk.method({
  1422. selector: "milliseconds:",
  1423. category: 'accessing',
  1424. fn: function (aNumber){
  1425. var self=this;
  1426. self.setMilliseconds(aNumber);
  1427. return self;},
  1428. args: ["aNumber"],
  1429. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  1430. messageSends: [],
  1431. referencedClasses: []
  1432. }),
  1433. smalltalk.Date);
  1434. smalltalk.addMethod(
  1435. "_minutes",
  1436. smalltalk.method({
  1437. selector: "minutes",
  1438. category: 'accessing',
  1439. fn: function (){
  1440. var self=this;
  1441. return self.getMinutes();
  1442. return self;},
  1443. args: [],
  1444. source: "minutes\x0a\x09<return self.getMinutes()>",
  1445. messageSends: [],
  1446. referencedClasses: []
  1447. }),
  1448. smalltalk.Date);
  1449. smalltalk.addMethod(
  1450. "_minutes_",
  1451. smalltalk.method({
  1452. selector: "minutes:",
  1453. category: 'accessing',
  1454. fn: function (aNumber){
  1455. var self=this;
  1456. self.setMinutes(aNumber);
  1457. return self;},
  1458. args: ["aNumber"],
  1459. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  1460. messageSends: [],
  1461. referencedClasses: []
  1462. }),
  1463. smalltalk.Date);
  1464. smalltalk.addMethod(
  1465. "_month",
  1466. smalltalk.method({
  1467. selector: "month",
  1468. category: 'accessing',
  1469. fn: function (){
  1470. var self=this;
  1471. return self.getMonth() + 1;
  1472. return self;},
  1473. args: [],
  1474. source: "month\x0a\x09<return self.getMonth() + 1>",
  1475. messageSends: [],
  1476. referencedClasses: []
  1477. }),
  1478. smalltalk.Date);
  1479. smalltalk.addMethod(
  1480. "_month_",
  1481. smalltalk.method({
  1482. selector: "month:",
  1483. category: 'accessing',
  1484. fn: function (aNumber){
  1485. var self=this;
  1486. self.setMonth(aNumber - 1);
  1487. return self;},
  1488. args: ["aNumber"],
  1489. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  1490. messageSends: [],
  1491. referencedClasses: []
  1492. }),
  1493. smalltalk.Date);
  1494. smalltalk.addMethod(
  1495. "_printString",
  1496. smalltalk.method({
  1497. selector: "printString",
  1498. category: 'printing',
  1499. fn: function (){
  1500. var self=this;
  1501. return smalltalk.send(self, "_asString", []);
  1502. return self;},
  1503. args: [],
  1504. source: "printString\x0a\x09^self asString",
  1505. messageSends: ["asString"],
  1506. referencedClasses: []
  1507. }),
  1508. smalltalk.Date);
  1509. smalltalk.addMethod(
  1510. "_seconds",
  1511. smalltalk.method({
  1512. selector: "seconds",
  1513. category: 'accessing',
  1514. fn: function (){
  1515. var self=this;
  1516. return self.getSeconds();
  1517. return self;},
  1518. args: [],
  1519. source: "seconds\x0a\x09<return self.getSeconds()>",
  1520. messageSends: [],
  1521. referencedClasses: []
  1522. }),
  1523. smalltalk.Date);
  1524. smalltalk.addMethod(
  1525. "_seconds_",
  1526. smalltalk.method({
  1527. selector: "seconds:",
  1528. category: 'accessing',
  1529. fn: function (aNumber){
  1530. var self=this;
  1531. self.setSeconds(aNumber);
  1532. return self;},
  1533. args: ["aNumber"],
  1534. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  1535. messageSends: [],
  1536. referencedClasses: []
  1537. }),
  1538. smalltalk.Date);
  1539. smalltalk.addMethod(
  1540. "_time",
  1541. smalltalk.method({
  1542. selector: "time",
  1543. category: 'accessing',
  1544. fn: function (){
  1545. var self=this;
  1546. return self.getTime();
  1547. return self;},
  1548. args: [],
  1549. source: "time\x0a\x09<return self.getTime()>",
  1550. messageSends: [],
  1551. referencedClasses: []
  1552. }),
  1553. smalltalk.Date);
  1554. smalltalk.addMethod(
  1555. "_time_",
  1556. smalltalk.method({
  1557. selector: "time:",
  1558. category: 'accessing',
  1559. fn: function (aNumber){
  1560. var self=this;
  1561. self.setTime(aNumber);
  1562. return self;},
  1563. args: ["aNumber"],
  1564. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  1565. messageSends: [],
  1566. referencedClasses: []
  1567. }),
  1568. smalltalk.Date);
  1569. smalltalk.addMethod(
  1570. "_year",
  1571. smalltalk.method({
  1572. selector: "year",
  1573. category: 'accessing',
  1574. fn: function (){
  1575. var self=this;
  1576. return self.getFullYear();
  1577. return self;},
  1578. args: [],
  1579. source: "year\x0a\x09<return self.getFullYear()>",
  1580. messageSends: [],
  1581. referencedClasses: []
  1582. }),
  1583. smalltalk.Date);
  1584. smalltalk.addMethod(
  1585. "_year_",
  1586. smalltalk.method({
  1587. selector: "year:",
  1588. category: 'accessing',
  1589. fn: function (aNumber){
  1590. var self=this;
  1591. self.setFullYear(aNumber);
  1592. return self;},
  1593. args: ["aNumber"],
  1594. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  1595. messageSends: [],
  1596. referencedClasses: []
  1597. }),
  1598. smalltalk.Date);
  1599. smalltalk.addMethod(
  1600. "_fromMilliseconds_",
  1601. smalltalk.method({
  1602. selector: "fromMilliseconds:",
  1603. category: 'instance creation',
  1604. fn: function (aNumber){
  1605. var self=this;
  1606. return smalltalk.send(self, "_new_", [aNumber]);
  1607. return self;},
  1608. args: ["aNumber"],
  1609. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  1610. messageSends: ["new:"],
  1611. referencedClasses: []
  1612. }),
  1613. smalltalk.Date.klass);
  1614. smalltalk.addMethod(
  1615. "_fromSeconds_",
  1616. smalltalk.method({
  1617. selector: "fromSeconds:",
  1618. category: 'instance creation',
  1619. fn: function (aNumber){
  1620. var self=this;
  1621. return smalltalk.send(self, "_fromMilliseconds_", [((($receiver = aNumber).klass === smalltalk.Number) ? $receiver *(1000) : smalltalk.send($receiver, "__star", [(1000)]))]);
  1622. return self;},
  1623. args: ["aNumber"],
  1624. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  1625. messageSends: ["fromMilliseconds:", "*"],
  1626. referencedClasses: []
  1627. }),
  1628. smalltalk.Date.klass);
  1629. smalltalk.addMethod(
  1630. "_fromString_",
  1631. smalltalk.method({
  1632. selector: "fromString:",
  1633. category: 'instance creation',
  1634. fn: function (aString){
  1635. var self=this;
  1636. return smalltalk.send(self, "_new_", [aString]);
  1637. return self;},
  1638. args: ["aString"],
  1639. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  1640. messageSends: ["new:"],
  1641. referencedClasses: []
  1642. }),
  1643. smalltalk.Date.klass);
  1644. smalltalk.addMethod(
  1645. "_millisecondsToRun_",
  1646. smalltalk.method({
  1647. selector: "millisecondsToRun:",
  1648. category: 'instance creation',
  1649. fn: function (aBlock){
  1650. var self=this;
  1651. var t=nil;
  1652. (t=smalltalk.send((smalltalk.Date || Date), "_now", []));
  1653. smalltalk.send(aBlock, "_value", []);
  1654. return ((($receiver = smalltalk.send((smalltalk.Date || Date), "_now", [])).klass === smalltalk.Number) ? $receiver -t : smalltalk.send($receiver, "__minus", [t]));
  1655. return self;},
  1656. args: ["aBlock"],
  1657. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  1658. messageSends: ["now", "value", "-"],
  1659. referencedClasses: ["Date"]
  1660. }),
  1661. smalltalk.Date.klass);
  1662. smalltalk.addMethod(
  1663. "_new_",
  1664. smalltalk.method({
  1665. selector: "new:",
  1666. category: 'instance creation',
  1667. fn: function (anObject){
  1668. var self=this;
  1669. return new Date(anObject);
  1670. return self;},
  1671. args: ["anObject"],
  1672. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  1673. messageSends: [],
  1674. referencedClasses: []
  1675. }),
  1676. smalltalk.Date.klass);
  1677. smalltalk.addMethod(
  1678. "_now",
  1679. smalltalk.method({
  1680. selector: "now",
  1681. category: 'instance creation',
  1682. fn: function (){
  1683. var self=this;
  1684. return smalltalk.send(self, "_today", []);
  1685. return self;},
  1686. args: [],
  1687. source: "now\x0a\x09^self today",
  1688. messageSends: ["today"],
  1689. referencedClasses: []
  1690. }),
  1691. smalltalk.Date.klass);
  1692. smalltalk.addMethod(
  1693. "_today",
  1694. smalltalk.method({
  1695. selector: "today",
  1696. category: 'instance creation',
  1697. fn: function (){
  1698. var self=this;
  1699. return smalltalk.send(self, "_new", []);
  1700. return self;},
  1701. args: [],
  1702. source: "today\x0a\x09^self new",
  1703. messageSends: ["new"],
  1704. referencedClasses: []
  1705. }),
  1706. smalltalk.Date.klass);
  1707. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  1708. smalltalk.JSObjectProxy.comment="JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.\x0aJSOjbectProxy makes intensive use of `#doesNotUnderstand:`.\x0a\x0a## Examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a window alert: 'hello world'.\x0a window inspect.\x0a (window jQuery: 'body') append: 'hello world'\x0a\x0aSmalltalk messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown. \x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`."
  1709. smalltalk.addMethod(
  1710. "_at_",
  1711. smalltalk.method({
  1712. selector: "at:",
  1713. category: 'accessing',
  1714. fn: function (aSymbol){
  1715. var self=this;
  1716. var attr=nil;
  1717. (attr=smalltalk.send(aSymbol, "_asString", []));
  1718. return self['@jsObject'][attr];
  1719. return self;},
  1720. args: ["aSymbol"],
  1721. source: "at: aSymbol\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<return self['@jsObject'][attr]>",
  1722. messageSends: ["asString"],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.JSObjectProxy);
  1726. smalltalk.addMethod(
  1727. "_at_put_",
  1728. smalltalk.method({
  1729. selector: "at:put:",
  1730. category: 'accessing',
  1731. fn: function (aSymbol, anObject){
  1732. var self=this;
  1733. var attr=nil;
  1734. (attr=smalltalk.send(aSymbol, "_asString", []));
  1735. self['@jsObject'][attr] = anObject;
  1736. return self;},
  1737. args: ["aSymbol", "anObject"],
  1738. source: "at: aSymbol put: anObject\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<self['@jsObject'][attr] = anObject>",
  1739. messageSends: ["asString"],
  1740. referencedClasses: []
  1741. }),
  1742. smalltalk.JSObjectProxy);
  1743. smalltalk.addMethod(
  1744. "_doesNotUnderstand_",
  1745. smalltalk.method({
  1746. selector: "doesNotUnderstand:",
  1747. category: 'proxy',
  1748. fn: function (aMessage){
  1749. var self=this;
  1750. var obj=nil;
  1751. var selector=nil;
  1752. var jsSelector=nil;
  1753. var arguments=nil;
  1754. (obj=smalltalk.send(self, "_jsObject", []));
  1755. (selector=smalltalk.send(aMessage, "_selector", []));
  1756. (jsSelector=smalltalk.send(selector, "_asJavaScriptSelector", []));
  1757. (arguments=smalltalk.send(aMessage, "_arguments", []));
  1758. if(obj[jsSelector] != undefined) {return smalltalk.send(obj, jsSelector, arguments)};
  1759. smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.JSObjectProxy.superclass || nil);
  1760. return self;},
  1761. args: ["aMessage"],
  1762. source: "doesNotUnderstand: aMessage\x0a\x09| obj selector jsSelector arguments |\x0a\x09obj := self jsObject.\x0a\x09selector := aMessage selector.\x0a\x09jsSelector := selector asJavaScriptSelector.\x0a\x09arguments := aMessage arguments.\x0a\x09<if(obj[jsSelector] != undefined) {return smalltalk.send(obj, jsSelector, arguments)}>.\x0a\x09super doesNotUnderstand: aMessage",
  1763. messageSends: ["jsObject", "selector", "asJavaScriptSelector", "arguments", "doesNotUnderstand:"],
  1764. referencedClasses: []
  1765. }),
  1766. smalltalk.JSObjectProxy);
  1767. smalltalk.addMethod(
  1768. "_inspectOn_",
  1769. smalltalk.method({
  1770. selector: "inspectOn:",
  1771. category: 'proxy',
  1772. fn: function (anInspector){
  1773. var self=this;
  1774. var variables=nil;
  1775. (variables=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  1776. smalltalk.send(variables, "_at_put_", ["#self", smalltalk.send(self, "_jsObject", [])]);
  1777. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  1778. for(var i in self['@jsObject']) {
  1779. variables._at_put_(i, self['@jsObject'][i]);
  1780. };
  1781. smalltalk.send(anInspector, "_setVariables_", [variables]);
  1782. return self;},
  1783. args: ["anInspector"],
  1784. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09<for(var i in self['@jsObject']) {\x0a\x09\x09variables._at_put_(i, self['@jsObject'][i]);\x0a\x09}>.\x0a\x09anInspector setVariables: variables",
  1785. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "setVariables:"],
  1786. referencedClasses: ["Dictionary"]
  1787. }),
  1788. smalltalk.JSObjectProxy);
  1789. smalltalk.addMethod(
  1790. "_jsObject",
  1791. smalltalk.method({
  1792. selector: "jsObject",
  1793. category: 'accessing',
  1794. fn: function (){
  1795. var self=this;
  1796. return self['@jsObject'];
  1797. return self;},
  1798. args: [],
  1799. source: "jsObject\x0a\x09^jsObject",
  1800. messageSends: [],
  1801. referencedClasses: []
  1802. }),
  1803. smalltalk.JSObjectProxy);
  1804. smalltalk.addMethod(
  1805. "_jsObject_",
  1806. smalltalk.method({
  1807. selector: "jsObject:",
  1808. category: 'accessing',
  1809. fn: function (aJSObject){
  1810. var self=this;
  1811. (self['@jsObject']=aJSObject);
  1812. return self;},
  1813. args: ["aJSObject"],
  1814. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  1815. messageSends: [],
  1816. referencedClasses: []
  1817. }),
  1818. smalltalk.JSObjectProxy);
  1819. smalltalk.addMethod(
  1820. "_printString",
  1821. smalltalk.method({
  1822. selector: "printString",
  1823. category: 'proxy',
  1824. fn: function (){
  1825. var self=this;
  1826. return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_toString", []);
  1827. return self;},
  1828. args: [],
  1829. source: "printString\x0a\x09^self jsObject toString",
  1830. messageSends: ["toString", "jsObject"],
  1831. referencedClasses: []
  1832. }),
  1833. smalltalk.JSObjectProxy);
  1834. smalltalk.addMethod(
  1835. "_on_",
  1836. smalltalk.method({
  1837. selector: "on:",
  1838. category: 'instance creation',
  1839. fn: function (aJSObject){
  1840. var self=this;
  1841. return (function($rec){smalltalk.send($rec, "_jsObject_", [aJSObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  1842. return self;},
  1843. args: ["aJSObject"],
  1844. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  1845. messageSends: ["jsObject:", "yourself", "new"],
  1846. referencedClasses: []
  1847. }),
  1848. smalltalk.JSObjectProxy.klass);
  1849. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  1850. 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]."
  1851. smalltalk.addMethod(
  1852. "_&",
  1853. smalltalk.method({
  1854. selector: "&",
  1855. category: 'converting',
  1856. fn: function (aNumber){
  1857. var self=this;
  1858. return self & aNumber;
  1859. return self;},
  1860. args: ["aNumber"],
  1861. source: "& aNumber\x0a\x09<return self & aNumber>",
  1862. messageSends: [],
  1863. referencedClasses: []
  1864. }),
  1865. smalltalk.Number);
  1866. smalltalk.addMethod(
  1867. "__star",
  1868. smalltalk.method({
  1869. selector: "*",
  1870. category: 'arithmetic',
  1871. fn: function (aNumber){
  1872. var self=this;
  1873. return self * aNumber;
  1874. return self;},
  1875. args: ["aNumber"],
  1876. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  1877. messageSends: [],
  1878. referencedClasses: []
  1879. }),
  1880. smalltalk.Number);
  1881. smalltalk.addMethod(
  1882. "__plus",
  1883. smalltalk.method({
  1884. selector: "+",
  1885. category: 'arithmetic',
  1886. fn: function (aNumber){
  1887. var self=this;
  1888. return self + aNumber;
  1889. return self;},
  1890. args: ["aNumber"],
  1891. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  1892. messageSends: [],
  1893. referencedClasses: []
  1894. }),
  1895. smalltalk.Number);
  1896. smalltalk.addMethod(
  1897. "__minus",
  1898. smalltalk.method({
  1899. selector: "-",
  1900. category: 'arithmetic',
  1901. fn: function (aNumber){
  1902. var self=this;
  1903. return self - aNumber;
  1904. return self;},
  1905. args: ["aNumber"],
  1906. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  1907. messageSends: [],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.Number);
  1911. smalltalk.addMethod(
  1912. "__slash",
  1913. smalltalk.method({
  1914. selector: "/",
  1915. category: 'arithmetic',
  1916. fn: function (aNumber){
  1917. var self=this;
  1918. return self / aNumber;
  1919. return self;},
  1920. args: ["aNumber"],
  1921. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  1922. messageSends: [],
  1923. referencedClasses: []
  1924. }),
  1925. smalltalk.Number);
  1926. smalltalk.addMethod(
  1927. "__lt",
  1928. smalltalk.method({
  1929. selector: "<",
  1930. category: 'comparing',
  1931. fn: function (aNumber){
  1932. var self=this;
  1933. return self < aNumber;
  1934. return self;},
  1935. args: ["aNumber"],
  1936. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  1937. messageSends: [],
  1938. referencedClasses: []
  1939. }),
  1940. smalltalk.Number);
  1941. smalltalk.addMethod(
  1942. "__lt_eq",
  1943. smalltalk.method({
  1944. selector: "<=",
  1945. category: 'comparing',
  1946. fn: function (aNumber){
  1947. var self=this;
  1948. return self <= aNumber;
  1949. return self;},
  1950. args: ["aNumber"],
  1951. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  1952. messageSends: [],
  1953. referencedClasses: []
  1954. }),
  1955. smalltalk.Number);
  1956. smalltalk.addMethod(
  1957. "__eq",
  1958. smalltalk.method({
  1959. selector: "=",
  1960. category: 'comparing',
  1961. fn: function (aNumber){
  1962. var self=this;
  1963. var $early={};
  1964. try{((($receiver = smalltalk.send(aNumber, "_isNumber", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  1965. return Number(self) == aNumber;
  1966. return self;
  1967. } catch(e) {if(e===$early)return e[0]; throw e}},
  1968. args: ["aNumber"],
  1969. source: "= aNumber\x0a\x09aNumber isNumber ifFalse: [^false]. \x0a\x09<return Number(self) == aNumber>",
  1970. messageSends: ["ifFalse:", "isNumber"],
  1971. referencedClasses: []
  1972. }),
  1973. smalltalk.Number);
  1974. smalltalk.addMethod(
  1975. "__gt",
  1976. smalltalk.method({
  1977. selector: ">",
  1978. category: 'comparing',
  1979. fn: function (aNumber){
  1980. var self=this;
  1981. return self > aNumber;
  1982. return self;},
  1983. args: ["aNumber"],
  1984. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  1985. messageSends: [],
  1986. referencedClasses: []
  1987. }),
  1988. smalltalk.Number);
  1989. smalltalk.addMethod(
  1990. "__gt_eq",
  1991. smalltalk.method({
  1992. selector: ">=",
  1993. category: 'comparing',
  1994. fn: function (aNumber){
  1995. var self=this;
  1996. return self >= aNumber;
  1997. return self;},
  1998. args: ["aNumber"],
  1999. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  2000. messageSends: [],
  2001. referencedClasses: []
  2002. }),
  2003. smalltalk.Number);
  2004. smalltalk.addMethod(
  2005. "__at",
  2006. smalltalk.method({
  2007. selector: "@",
  2008. category: 'converting',
  2009. fn: function (aNumber){
  2010. var self=this;
  2011. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [self, aNumber]);
  2012. return self;},
  2013. args: ["aNumber"],
  2014. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  2015. messageSends: ["x:y:"],
  2016. referencedClasses: ["Point"]
  2017. }),
  2018. smalltalk.Number);
  2019. smalltalk.addMethod(
  2020. "_\x5c\x5c",
  2021. smalltalk.method({
  2022. selector: "\x5c\x5c",
  2023. category: 'arithmetic',
  2024. fn: function (aNumber){
  2025. var self=this;
  2026. return self % aNumber;
  2027. return self;},
  2028. args: ["aNumber"],
  2029. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  2030. messageSends: [],
  2031. referencedClasses: []
  2032. }),
  2033. smalltalk.Number);
  2034. smalltalk.addMethod(
  2035. "_asJSON",
  2036. smalltalk.method({
  2037. selector: "asJSON",
  2038. category: 'converting',
  2039. fn: function (){
  2040. var self=this;
  2041. return self;
  2042. return self;},
  2043. args: [],
  2044. source: "asJSON\x0a\x09^self",
  2045. messageSends: [],
  2046. referencedClasses: []
  2047. }),
  2048. smalltalk.Number);
  2049. smalltalk.addMethod(
  2050. "_asJavascript",
  2051. smalltalk.method({
  2052. selector: "asJavascript",
  2053. category: 'converting',
  2054. fn: function (){
  2055. var self=this;
  2056. return smalltalk.send(smalltalk.send("(", "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [")"]);
  2057. return self;},
  2058. args: [],
  2059. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  2060. messageSends: [",", "printString"],
  2061. referencedClasses: []
  2062. }),
  2063. smalltalk.Number);
  2064. smalltalk.addMethod(
  2065. "_asPoint",
  2066. smalltalk.method({
  2067. selector: "asPoint",
  2068. category: 'converting',
  2069. fn: function (){
  2070. var self=this;
  2071. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [self, self]);
  2072. return self;},
  2073. args: [],
  2074. source: "asPoint\x0a\x09^Point x: self y: self",
  2075. messageSends: ["x:y:"],
  2076. referencedClasses: ["Point"]
  2077. }),
  2078. smalltalk.Number);
  2079. smalltalk.addMethod(
  2080. "_asString",
  2081. smalltalk.method({
  2082. selector: "asString",
  2083. category: 'converting',
  2084. fn: function (){
  2085. var self=this;
  2086. return smalltalk.send(self, "_printString", []);
  2087. return self;},
  2088. args: [],
  2089. source: "asString\x0a\x09^self printString",
  2090. messageSends: ["printString"],
  2091. referencedClasses: []
  2092. }),
  2093. smalltalk.Number);
  2094. smalltalk.addMethod(
  2095. "_atRandom",
  2096. smalltalk.method({
  2097. selector: "atRandom",
  2098. category: 'converting',
  2099. fn: function (){
  2100. var self=this;
  2101. return ((($receiver = smalltalk.send(((($receiver = smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", [])).klass === smalltalk.Number) ? $receiver *self : smalltalk.send($receiver, "__star", [self])), "_truncated", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));
  2102. return self;},
  2103. args: [],
  2104. source: "atRandom\x0a ^(Random new next * self) truncated + 1",
  2105. messageSends: ["+", "truncated", "*", "next", "new"],
  2106. referencedClasses: ["Random"]
  2107. }),
  2108. smalltalk.Number);
  2109. smalltalk.addMethod(
  2110. "_clearInterval",
  2111. smalltalk.method({
  2112. selector: "clearInterval",
  2113. category: 'timeouts/intervals',
  2114. fn: function (){
  2115. var self=this;
  2116. clearInterval(Number(self));
  2117. return self;},
  2118. args: [],
  2119. source: "clearInterval\x0a\x09<clearInterval(Number(self))>",
  2120. messageSends: [],
  2121. referencedClasses: []
  2122. }),
  2123. smalltalk.Number);
  2124. smalltalk.addMethod(
  2125. "_clearTimeout",
  2126. smalltalk.method({
  2127. selector: "clearTimeout",
  2128. category: 'timeouts/intervals',
  2129. fn: function (){
  2130. var self=this;
  2131. clearTimeout(Number(self));
  2132. return self;},
  2133. args: [],
  2134. source: "clearTimeout\x0a\x09<clearTimeout(Number(self))>",
  2135. messageSends: [],
  2136. referencedClasses: []
  2137. }),
  2138. smalltalk.Number);
  2139. smalltalk.addMethod(
  2140. "_copy",
  2141. smalltalk.method({
  2142. selector: "copy",
  2143. category: 'copying',
  2144. fn: function (){
  2145. var self=this;
  2146. return self;
  2147. return self;},
  2148. args: [],
  2149. source: "copy\x0a\x09^self",
  2150. messageSends: [],
  2151. referencedClasses: []
  2152. }),
  2153. smalltalk.Number);
  2154. smalltalk.addMethod(
  2155. "_deepCopy",
  2156. smalltalk.method({
  2157. selector: "deepCopy",
  2158. category: 'copying',
  2159. fn: function (){
  2160. var self=this;
  2161. return smalltalk.send(self, "_copy", []);
  2162. return self;},
  2163. args: [],
  2164. source: "deepCopy\x0a\x09^self copy",
  2165. messageSends: ["copy"],
  2166. referencedClasses: []
  2167. }),
  2168. smalltalk.Number);
  2169. smalltalk.addMethod(
  2170. "_even",
  2171. smalltalk.method({
  2172. selector: "even",
  2173. category: 'testing',
  2174. fn: function (){
  2175. var self=this;
  2176. return smalltalk.send((0), "__eq", [smalltalk.send(self, "_\\\\", [(2)])]);
  2177. return self;},
  2178. args: [],
  2179. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  2180. messageSends: ["=", "\x5c\x5c\x5c\x5c"],
  2181. referencedClasses: []
  2182. }),
  2183. smalltalk.Number);
  2184. smalltalk.addMethod(
  2185. "_identityHash",
  2186. smalltalk.method({
  2187. selector: "identityHash",
  2188. category: 'accessing',
  2189. fn: function (){
  2190. var self=this;
  2191. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", ["n"]);
  2192. return self;},
  2193. args: [],
  2194. source: "identityHash\x0a\x09^self asString, 'n'",
  2195. messageSends: [",", "asString"],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.Number);
  2199. smalltalk.addMethod(
  2200. "_isNumber",
  2201. smalltalk.method({
  2202. selector: "isNumber",
  2203. category: 'testing',
  2204. fn: function (){
  2205. var self=this;
  2206. return true;
  2207. return self;},
  2208. args: [],
  2209. source: "isNumber\x0a\x09^true",
  2210. messageSends: [],
  2211. referencedClasses: []
  2212. }),
  2213. smalltalk.Number);
  2214. smalltalk.addMethod(
  2215. "_isZero",
  2216. smalltalk.method({
  2217. selector: "isZero",
  2218. category: 'testing',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.send(self, "__eq", [(0)]);
  2222. return self;},
  2223. args: [],
  2224. source: "isZero\x0a\x09^self = 0",
  2225. messageSends: ["="],
  2226. referencedClasses: []
  2227. }),
  2228. smalltalk.Number);
  2229. smalltalk.addMethod(
  2230. "_max_",
  2231. smalltalk.method({
  2232. selector: "max:",
  2233. category: 'arithmetic',
  2234. fn: function (aNumber){
  2235. var self=this;
  2236. return Math.max(self, aNumber);;
  2237. return self;},
  2238. args: ["aNumber"],
  2239. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  2240. messageSends: [],
  2241. referencedClasses: []
  2242. }),
  2243. smalltalk.Number);
  2244. smalltalk.addMethod(
  2245. "_min_",
  2246. smalltalk.method({
  2247. selector: "min:",
  2248. category: 'arithmetic',
  2249. fn: function (aNumber){
  2250. var self=this;
  2251. return Math.min(self, aNumber);;
  2252. return self;},
  2253. args: ["aNumber"],
  2254. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  2255. messageSends: [],
  2256. referencedClasses: []
  2257. }),
  2258. smalltalk.Number);
  2259. smalltalk.addMethod(
  2260. "_negated",
  2261. smalltalk.method({
  2262. selector: "negated",
  2263. category: 'arithmetic',
  2264. fn: function (){
  2265. var self=this;
  2266. return (0) - self;
  2267. return self;},
  2268. args: [],
  2269. source: "negated\x0a\x09^0 - self",
  2270. messageSends: ["-"],
  2271. referencedClasses: []
  2272. }),
  2273. smalltalk.Number);
  2274. smalltalk.addMethod(
  2275. "_negative",
  2276. smalltalk.method({
  2277. selector: "negative",
  2278. category: 'testing',
  2279. fn: function (){
  2280. var self=this;
  2281. return self < (0);
  2282. return self;},
  2283. args: [],
  2284. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  2285. messageSends: ["<"],
  2286. referencedClasses: []
  2287. }),
  2288. smalltalk.Number);
  2289. smalltalk.addMethod(
  2290. "_odd",
  2291. smalltalk.method({
  2292. selector: "odd",
  2293. category: 'testing',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  2297. return self;},
  2298. args: [],
  2299. source: "odd\x0a\x09^ self even not",
  2300. messageSends: ["not", "even"],
  2301. referencedClasses: []
  2302. }),
  2303. smalltalk.Number);
  2304. smalltalk.addMethod(
  2305. "_positive",
  2306. smalltalk.method({
  2307. selector: "positive",
  2308. category: 'testing',
  2309. fn: function (){
  2310. var self=this;
  2311. return self >= (0);
  2312. return self;},
  2313. args: [],
  2314. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  2315. messageSends: [">="],
  2316. referencedClasses: []
  2317. }),
  2318. smalltalk.Number);
  2319. smalltalk.addMethod(
  2320. "_printShowingDecimalPlaces_",
  2321. smalltalk.method({
  2322. selector: "printShowingDecimalPlaces:",
  2323. category: 'printing',
  2324. fn: function (placesDesired){
  2325. var self=this;
  2326. return self.toFixed(placesDesired);
  2327. return self;},
  2328. args: ["placesDesired"],
  2329. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  2330. messageSends: [],
  2331. referencedClasses: []
  2332. }),
  2333. smalltalk.Number);
  2334. smalltalk.addMethod(
  2335. "_printString",
  2336. smalltalk.method({
  2337. selector: "printString",
  2338. category: 'printing',
  2339. fn: function (){
  2340. var self=this;
  2341. return String(self);
  2342. return self;},
  2343. args: [],
  2344. source: "printString\x0a\x09<return String(self)>",
  2345. messageSends: [],
  2346. referencedClasses: []
  2347. }),
  2348. smalltalk.Number);
  2349. smalltalk.addMethod(
  2350. "_rounded",
  2351. smalltalk.method({
  2352. selector: "rounded",
  2353. category: 'converting',
  2354. fn: function (){
  2355. var self=this;
  2356. return Math.round(self);;
  2357. return self;},
  2358. args: [],
  2359. source: "rounded\x0a\x09<return Math.round(self);>",
  2360. messageSends: [],
  2361. referencedClasses: []
  2362. }),
  2363. smalltalk.Number);
  2364. smalltalk.addMethod(
  2365. "_sqrt",
  2366. smalltalk.method({
  2367. selector: "sqrt",
  2368. category: 'arithmetic',
  2369. fn: function (){
  2370. var self=this;
  2371. return Math.sqrt(self);
  2372. return self;},
  2373. args: [],
  2374. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  2375. messageSends: [],
  2376. referencedClasses: []
  2377. }),
  2378. smalltalk.Number);
  2379. smalltalk.addMethod(
  2380. "_squared",
  2381. smalltalk.method({
  2382. selector: "squared",
  2383. category: 'arithmetic',
  2384. fn: function (){
  2385. var self=this;
  2386. return self * self;
  2387. return self;},
  2388. args: [],
  2389. source: "squared\x0a\x09^self * self",
  2390. messageSends: ["*"],
  2391. referencedClasses: []
  2392. }),
  2393. smalltalk.Number);
  2394. smalltalk.addMethod(
  2395. "_timesRepeat_",
  2396. smalltalk.method({
  2397. selector: "timesRepeat:",
  2398. category: 'enumerating',
  2399. fn: function (aBlock){
  2400. var self=this;
  2401. var integer=nil;
  2402. var count=nil;
  2403. (integer=smalltalk.send(self, "_truncated", []));
  2404. (count=(1));
  2405. (function(){while(!(function(){return ((($receiver = count).klass === smalltalk.Number) ? $receiver >self : smalltalk.send($receiver, "__gt", [self]));})()) {(function(){smalltalk.send(aBlock, "_value", []);return (count=((($receiver = count).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  2406. return self;},
  2407. args: ["aBlock"],
  2408. source: "timesRepeat: aBlock\x0a\x09| integer count |\x0a\x09integer := self truncated.\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09 aBlock value.\x0a\x09 count := count + 1]",
  2409. messageSends: ["truncated", "whileFalse:", ">", "value", "+"],
  2410. referencedClasses: []
  2411. }),
  2412. smalltalk.Number);
  2413. smalltalk.addMethod(
  2414. "_to_",
  2415. smalltalk.method({
  2416. selector: "to:",
  2417. category: 'converting',
  2418. fn: function (aNumber){
  2419. var self=this;
  2420. var array=nil;
  2421. var first=nil;
  2422. var last=nil;
  2423. var count=nil;
  2424. (first=smalltalk.send(self, "_truncated", []));
  2425. (last=((($receiver = smalltalk.send(aNumber, "_truncated", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));
  2426. (count=(1));
  2427. (array=smalltalk.send((smalltalk.Array || Array), "_new", []));
  2428. smalltalk.send(((($receiver = last).klass === smalltalk.Number) ? $receiver -first : smalltalk.send($receiver, "__minus", [first])), "_timesRepeat_", [(function(){smalltalk.send(array, "_at_put_", [count, first]);(count=((($receiver = count).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (first=((($receiver = first).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  2429. return array;
  2430. return self;},
  2431. args: ["aNumber"],
  2432. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09 array at: count put: first.\x0a\x09 count := count + 1.\x0a\x09 first := first + 1].\x0a\x09^array",
  2433. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"],
  2434. referencedClasses: ["Array"]
  2435. }),
  2436. smalltalk.Number);
  2437. smalltalk.addMethod(
  2438. "_to_by_",
  2439. smalltalk.method({
  2440. selector: "to:by:",
  2441. category: 'converting',
  2442. fn: function (stop, step){
  2443. var self=this;
  2444. var array=nil;
  2445. var value=nil;
  2446. var pos=nil;
  2447. (value=self);
  2448. (array=smalltalk.send((smalltalk.Array || Array), "_new", []));
  2449. (pos=(1));
  2450. ((($receiver = smalltalk.send(step, "__eq", [(0)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})]));
  2451. ((($receiver = ((($receiver = step).klass === smalltalk.Number) ? $receiver <(0) : smalltalk.send($receiver, "__lt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})() : (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();}), (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(array, "_at_put_", [pos, value]);(pos=((($receiver = pos).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})]));
  2452. return array;
  2453. return self;},
  2454. args: ["stop", "step"],
  2455. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09 \x09\x09\x09array at: pos put: value.\x0a\x09 \x09\x09\x09pos := pos + 1.\x0a\x09 \x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09 \x09\x09\x09array at: pos put: value.\x0a\x09 \x09\x09\x09pos := pos + 1.\x0a\x09 \x09\x09\x09value := value + step]].\x0a\x09^array",
  2456. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="],
  2457. referencedClasses: ["Array"]
  2458. }),
  2459. smalltalk.Number);
  2460. smalltalk.addMethod(
  2461. "_to_by_do_",
  2462. smalltalk.method({
  2463. selector: "to:by:do:",
  2464. category: 'enumerating',
  2465. fn: function (stop, step, aBlock){
  2466. var self=this;
  2467. var value=nil;
  2468. (value=self);
  2469. ((($receiver = smalltalk.send(step, "__eq", [(0)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_error_", ["step must be non-zero"]);})]));
  2470. ((($receiver = ((($receiver = step).klass === smalltalk.Number) ? $receiver <(0) : smalltalk.send($receiver, "__lt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})() : (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver >=stop : smalltalk.send($receiver, "__gt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();}), (function(){return (function(){while((function(){return ((($receiver = value).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [value]);return (value=((($receiver = value).klass === smalltalk.Number) ? $receiver +step : smalltalk.send($receiver, "__plus", [step])));})()}})();})]));
  2471. return self;},
  2472. args: ["stop", "step", "aBlock"],
  2473. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09 \x09\x09\x09aBlock value: value.\x0a\x09 \x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09 \x09\x09\x09aBlock value: value.\x0a\x09 \x09\x09\x09value := value + step]]",
  2474. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="],
  2475. referencedClasses: []
  2476. }),
  2477. smalltalk.Number);
  2478. smalltalk.addMethod(
  2479. "_to_do_",
  2480. smalltalk.method({
  2481. selector: "to:do:",
  2482. category: 'enumerating',
  2483. fn: function (stop, aBlock){
  2484. var self=this;
  2485. var nextValue=nil;
  2486. (nextValue=self);
  2487. (function(){while((function(){return ((($receiver = nextValue).klass === smalltalk.Number) ? $receiver <=stop : smalltalk.send($receiver, "__lt_eq", [stop]));})()) {(function(){smalltalk.send(aBlock, "_value_", [nextValue]);return (nextValue=((($receiver = nextValue).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  2488. return self;},
  2489. args: ["stop", "aBlock"],
  2490. 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]",
  2491. messageSends: ["whileTrue:", "<=", "value:", "+"],
  2492. referencedClasses: []
  2493. }),
  2494. smalltalk.Number);
  2495. smalltalk.addMethod(
  2496. "_truncated",
  2497. smalltalk.method({
  2498. selector: "truncated",
  2499. category: 'converting',
  2500. fn: function (){
  2501. var self=this;
  2502. var result=nil;
  2503. ((($receiver = self >= (0)).klass === smalltalk.Boolean) ? ($receiver ? (function(){return result = Math.floor(self);;})() : (function(){return result = (Math.floor(self * (-1)) * (-1));;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return result = Math.floor(self);;}), (function(){return result = (Math.floor(self * (-1)) * (-1));;})]));
  2504. return result;
  2505. return self;},
  2506. args: [],
  2507. source: "truncated\x0a|result|\x0a\x0a self >= 0 \x0a ifTrue: [<result = Math.floor(self);>]\x0a ifFalse: [<result = (Math.floor(self * (-1)) * (-1));>].\x0a\x0a ^ result",
  2508. messageSends: ["ifTrue:ifFalse:", ">="],
  2509. referencedClasses: []
  2510. }),
  2511. smalltalk.Number);
  2512. smalltalk.addMethod(
  2513. "_|",
  2514. smalltalk.method({
  2515. selector: "|",
  2516. category: 'converting',
  2517. fn: function (aNumber){
  2518. var self=this;
  2519. return self | aNumber;
  2520. return self;},
  2521. args: ["aNumber"],
  2522. source: "| aNumber\x0a\x09<return self | aNumber>",
  2523. messageSends: [],
  2524. referencedClasses: []
  2525. }),
  2526. smalltalk.Number);
  2527. smalltalk.addMethod(
  2528. "_pi",
  2529. smalltalk.method({
  2530. selector: "pi",
  2531. category: 'instance creation',
  2532. fn: function (){
  2533. var self=this;
  2534. return Math.PI;
  2535. return self;},
  2536. args: [],
  2537. source: "pi\x0a\x09<return Math.PI>",
  2538. messageSends: [],
  2539. referencedClasses: []
  2540. }),
  2541. smalltalk.Number.klass);
  2542. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  2543. 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'"
  2544. smalltalk.addMethod(
  2545. "_classes",
  2546. smalltalk.method({
  2547. selector: "classes",
  2548. category: 'classes',
  2549. fn: function (){
  2550. var self=this;
  2551. return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", []), "_select_", [(function(c){return smalltalk.send(smalltalk.send(c, "_package", []), "__eq_eq", [self]);})]);
  2552. return self;},
  2553. args: [],
  2554. source: "classes\x0a\x09\x22We need to do a reverse scan.\x22\x0a\x09^Smalltalk current classes select: [:c | c package == self]",
  2555. messageSends: ["select:", "classes", "current", "==", "package"],
  2556. referencedClasses: ["Smalltalk"]
  2557. }),
  2558. smalltalk.Package);
  2559. smalltalk.addMethod(
  2560. "_commitPathJs",
  2561. smalltalk.method({
  2562. selector: "commitPathJs",
  2563. category: 'accessing',
  2564. fn: function (){
  2565. var self=this;
  2566. return (($receiver = self['@commitPathJs']) == nil || $receiver == undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);})() : $receiver;
  2567. return self;},
  2568. args: [],
  2569. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  2570. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  2571. referencedClasses: []
  2572. }),
  2573. smalltalk.Package);
  2574. smalltalk.addMethod(
  2575. "_commitPathJs_",
  2576. smalltalk.method({
  2577. selector: "commitPathJs:",
  2578. category: 'accessing',
  2579. fn: function (aString){
  2580. var self=this;
  2581. (self['@commitPathJs']=aString);
  2582. return self;},
  2583. args: ["aString"],
  2584. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  2585. messageSends: [],
  2586. referencedClasses: []
  2587. }),
  2588. smalltalk.Package);
  2589. smalltalk.addMethod(
  2590. "_commitPathSt",
  2591. smalltalk.method({
  2592. selector: "commitPathSt",
  2593. category: 'accessing',
  2594. fn: function (){
  2595. var self=this;
  2596. return (($receiver = self['@commitPathSt']) == nil || $receiver == undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);})() : $receiver;
  2597. return self;},
  2598. args: [],
  2599. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  2600. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  2601. referencedClasses: []
  2602. }),
  2603. smalltalk.Package);
  2604. smalltalk.addMethod(
  2605. "_commitPathSt_",
  2606. smalltalk.method({
  2607. selector: "commitPathSt:",
  2608. category: 'accessing',
  2609. fn: function (aString){
  2610. var self=this;
  2611. (self['@commitPathSt']=aString);
  2612. return self;},
  2613. args: ["aString"],
  2614. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  2615. messageSends: [],
  2616. referencedClasses: []
  2617. }),
  2618. smalltalk.Package);
  2619. smalltalk.addMethod(
  2620. "_dependencies",
  2621. smalltalk.method({
  2622. selector: "dependencies",
  2623. category: 'accessing',
  2624. fn: function (){
  2625. var self=this;
  2626. return smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", (function(){return [];})]);
  2627. return self;},
  2628. args: [],
  2629. source: "dependencies\x0a\x09^self propertyAt: 'dependencies' ifAbsent: [#()]",
  2630. messageSends: ["propertyAt:ifAbsent:"],
  2631. referencedClasses: []
  2632. }),
  2633. smalltalk.Package);
  2634. smalltalk.addMethod(
  2635. "_dependencies_",
  2636. smalltalk.method({
  2637. selector: "dependencies:",
  2638. category: 'accessing',
  2639. fn: function (anArray){
  2640. var self=this;
  2641. return smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  2642. return self;},
  2643. args: ["anArray"],
  2644. source: "dependencies: anArray\x0a\x09^self propertyAt: 'dependencies' put: anArray",
  2645. messageSends: ["propertyAt:put:"],
  2646. referencedClasses: []
  2647. }),
  2648. smalltalk.Package);
  2649. smalltalk.addMethod(
  2650. "_jsProperties",
  2651. smalltalk.method({
  2652. selector: "jsProperties",
  2653. category: 'private',
  2654. fn: function (){
  2655. var self=this;
  2656. return self.properties;
  2657. return self;},
  2658. args: [],
  2659. source: "jsProperties\x0a\x09<return self.properties>",
  2660. messageSends: [],
  2661. referencedClasses: []
  2662. }),
  2663. smalltalk.Package);
  2664. smalltalk.addMethod(
  2665. "_jsProperties_",
  2666. smalltalk.method({
  2667. selector: "jsProperties:",
  2668. category: 'private',
  2669. fn: function (aJSObject){
  2670. var self=this;
  2671. return self.properties = aJSObject;
  2672. return self;},
  2673. args: ["aJSObject"],
  2674. source: "jsProperties: aJSObject\x0a\x09<return self.properties = aJSObject>",
  2675. messageSends: [],
  2676. referencedClasses: []
  2677. }),
  2678. smalltalk.Package);
  2679. smalltalk.addMethod(
  2680. "_name",
  2681. smalltalk.method({
  2682. selector: "name",
  2683. category: 'accessing',
  2684. fn: function (){
  2685. var self=this;
  2686. return self.pkgName;
  2687. return self;},
  2688. args: [],
  2689. source: "name\x0a\x09<return self.pkgName>",
  2690. messageSends: [],
  2691. referencedClasses: []
  2692. }),
  2693. smalltalk.Package);
  2694. smalltalk.addMethod(
  2695. "_name_",
  2696. smalltalk.method({
  2697. selector: "name:",
  2698. category: 'accessing',
  2699. fn: function (aString){
  2700. var self=this;
  2701. self.pkgName = aString;
  2702. return self;},
  2703. args: ["aString"],
  2704. source: "name: aString\x0a\x09<self.pkgName = aString>",
  2705. messageSends: [],
  2706. referencedClasses: []
  2707. }),
  2708. smalltalk.Package);
  2709. smalltalk.addMethod(
  2710. "_printString",
  2711. smalltalk.method({
  2712. selector: "printString",
  2713. category: 'printing',
  2714. fn: function (){
  2715. var self=this;
  2716. return smalltalk.send(self, "_name", []);
  2717. return self;},
  2718. args: [],
  2719. source: "printString\x0a\x09^self name",
  2720. messageSends: ["name"],
  2721. referencedClasses: []
  2722. }),
  2723. smalltalk.Package);
  2724. smalltalk.addMethod(
  2725. "_properties",
  2726. smalltalk.method({
  2727. selector: "properties",
  2728. category: 'accessing',
  2729. fn: function (){
  2730. var self=this;
  2731. return smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  2732. return self;},
  2733. args: [],
  2734. source: "properties\x0a\x09^Smalltalk current readJSObject: (self basicAt: 'properties')",
  2735. messageSends: ["readJSObject:", "current", "basicAt:"],
  2736. referencedClasses: ["Smalltalk"]
  2737. }),
  2738. smalltalk.Package);
  2739. smalltalk.addMethod(
  2740. "_properties_",
  2741. smalltalk.method({
  2742. selector: "properties:",
  2743. category: 'accessing',
  2744. fn: function (aDict){
  2745. var self=this;
  2746. var object=nil;
  2747. object = {};;
  2748. smalltalk.send(aDict, "_keysAndValuesDo_", [(function(key, value){return object[key] = value;})]);
  2749. return self.properties = object;
  2750. return self;},
  2751. args: ["aDict"],
  2752. source: "properties: aDict\x0a\x09\x22We store it as a javascript object.\x22\x0a\x09\x0a\x09| object |\x0a\x09<object = {};>.\x0a\x09aDict keysAndValuesDo: [:key :value |\x0a\x09\x09<object[key] = value>.\x0a\x09].\x0a\x09<return self.properties = object>",
  2753. messageSends: ["keysAndValuesDo:"],
  2754. referencedClasses: []
  2755. }),
  2756. smalltalk.Package);
  2757. smalltalk.addMethod(
  2758. "_propertiesAsJSON",
  2759. smalltalk.method({
  2760. selector: "propertiesAsJSON",
  2761. category: 'private',
  2762. fn: function (){
  2763. var self=this;
  2764. return JSON.stringify(self.properties);
  2765. return self;},
  2766. args: [],
  2767. source: "propertiesAsJSON\x0a\x09<return JSON.stringify(self.properties)>",
  2768. messageSends: [],
  2769. referencedClasses: []
  2770. }),
  2771. smalltalk.Package);
  2772. smalltalk.addMethod(
  2773. "_propertyAt_",
  2774. smalltalk.method({
  2775. selector: "propertyAt:",
  2776. category: 'properties',
  2777. fn: function (key){
  2778. var self=this;
  2779. return self.properties[key];
  2780. return self;},
  2781. args: ["key"],
  2782. source: "propertyAt: key\x0a\x0a\x09<return self.properties[key]>",
  2783. messageSends: [],
  2784. referencedClasses: []
  2785. }),
  2786. smalltalk.Package);
  2787. smalltalk.addMethod(
  2788. "_propertyAt_ifAbsent_",
  2789. smalltalk.method({
  2790. selector: "propertyAt:ifAbsent:",
  2791. category: 'properties',
  2792. fn: function (key, block){
  2793. var self=this;
  2794. return (($receiver = smalltalk.send(self, "_propertyAt_", [key])) == nil || $receiver == undefined) ? (function(){return smalltalk.send(block, "_value", []);})() : $receiver;
  2795. return self;},
  2796. args: ["key", "block"],
  2797. source: "propertyAt: key ifAbsent: block\x0a\x0a\x09^(self propertyAt: key) ifNil: [block value]",
  2798. messageSends: ["ifNil:", "propertyAt:", "value"],
  2799. referencedClasses: []
  2800. }),
  2801. smalltalk.Package);
  2802. smalltalk.addMethod(
  2803. "_propertyAt_put_",
  2804. smalltalk.method({
  2805. selector: "propertyAt:put:",
  2806. category: 'properties',
  2807. fn: function (key, value){
  2808. var self=this;
  2809. return self.properties[key] = value;
  2810. return self;},
  2811. args: ["key", "value"],
  2812. source: "propertyAt: key put: value\x0a\x0a\x09<return self.properties[key] = value>",
  2813. messageSends: [],
  2814. referencedClasses: []
  2815. }),
  2816. smalltalk.Package);
  2817. smalltalk.addMethod(
  2818. "_sortedClasses",
  2819. smalltalk.method({
  2820. selector: "sortedClasses",
  2821. category: 'classes',
  2822. fn: function (){
  2823. var self=this;
  2824. return smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  2825. return self;},
  2826. args: [],
  2827. 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",
  2828. messageSends: ["sortedClasses:", "class", "classes"],
  2829. referencedClasses: []
  2830. }),
  2831. smalltalk.Package);
  2832. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  2833. smalltalk.addMethod(
  2834. "_commitToLocalStorage_",
  2835. smalltalk.method({
  2836. selector: "commitToLocalStorage:",
  2837. category: 'loading-storing',
  2838. fn: function (aPackageName){
  2839. var self=this;
  2840. var key=nil;
  2841. var sourceCode=nil;
  2842. (key=smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]));
  2843. (sourceCode=smalltalk.send(smalltalk.send((smalltalk.Exporter || Exporter), "_new", []), "_exportPackage_", [aPackageName]));
  2844. localStorage[key] = escape(sourceCode);
  2845. return self;},
  2846. args: ["aPackageName"],
  2847. source: "commitToLocalStorage: aPackageName\x0a\x09| key sourceCode |\x0a\x09key := 'smalltalk.packages.' , aPackageName.\x0a\x09sourceCode := Exporter new exportPackage: aPackageName.\x0a\x09<localStorage[key] = escape(sourceCode)>",
  2848. messageSends: [",", "exportPackage:", "new"],
  2849. referencedClasses: ["Exporter"]
  2850. }),
  2851. smalltalk.Package.klass);
  2852. smalltalk.addMethod(
  2853. "_defaultCommitPathJs",
  2854. smalltalk.method({
  2855. selector: "defaultCommitPathJs",
  2856. category: 'commit paths',
  2857. fn: function (){
  2858. var self=this;
  2859. return (($receiver = self['@defaultCommitPathJs']) == nil || $receiver == undefined) ? (function(){return (self['@defaultCommitPathJs']="js");})() : $receiver;
  2860. return self;},
  2861. args: [],
  2862. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  2863. messageSends: ["ifNil:"],
  2864. referencedClasses: []
  2865. }),
  2866. smalltalk.Package.klass);
  2867. smalltalk.addMethod(
  2868. "_defaultCommitPathJs_",
  2869. smalltalk.method({
  2870. selector: "defaultCommitPathJs:",
  2871. category: 'commit paths',
  2872. fn: function (aString){
  2873. var self=this;
  2874. (self['@defaultCommitPathJs']=aString);
  2875. return self;},
  2876. args: ["aString"],
  2877. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  2878. messageSends: [],
  2879. referencedClasses: []
  2880. }),
  2881. smalltalk.Package.klass);
  2882. smalltalk.addMethod(
  2883. "_defaultCommitPathSt",
  2884. smalltalk.method({
  2885. selector: "defaultCommitPathSt",
  2886. category: 'commit paths',
  2887. fn: function (){
  2888. var self=this;
  2889. return (($receiver = self['@defaultCommitPathSt']) == nil || $receiver == undefined) ? (function(){return (self['@defaultCommitPathSt']="st");})() : $receiver;
  2890. return self;},
  2891. args: [],
  2892. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  2893. messageSends: ["ifNil:"],
  2894. referencedClasses: []
  2895. }),
  2896. smalltalk.Package.klass);
  2897. smalltalk.addMethod(
  2898. "_defaultCommitPathSt_",
  2899. smalltalk.method({
  2900. selector: "defaultCommitPathSt:",
  2901. category: 'commit paths',
  2902. fn: function (aString){
  2903. var self=this;
  2904. (self['@defaultCommitPathSt']=aString);
  2905. return self;},
  2906. args: ["aString"],
  2907. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  2908. messageSends: [],
  2909. referencedClasses: []
  2910. }),
  2911. smalltalk.Package.klass);
  2912. smalltalk.addMethod(
  2913. "_fetch_",
  2914. smalltalk.method({
  2915. selector: "fetch:",
  2916. category: 'loading-storing',
  2917. fn: function (aPackageName){
  2918. var self=this;
  2919. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  2920. return self;},
  2921. args: ["aPackageName"],
  2922. source: "fetch: aPackageName\x0a\x09self fetch: aPackageName prefix: self defaultCommitPathJs, '/'",
  2923. messageSends: ["fetch:prefix:", ",", "defaultCommitPathJs"],
  2924. referencedClasses: []
  2925. }),
  2926. smalltalk.Package.klass);
  2927. smalltalk.addMethod(
  2928. "_fetch_prefix_",
  2929. smalltalk.method({
  2930. selector: "fetch:prefix:",
  2931. category: 'loading-storing',
  2932. fn: function (aPackageName, aPrefix){
  2933. var self=this;
  2934. smalltalk.send((typeof jQuery == 'undefined' ? nil : jQuery), "_getScript_onSuccess_", [smalltalk.send(smalltalk.send(aPrefix, "__comma", [aPackageName]), "__comma", [".js"]), (function(){return smalltalk.send((smalltalk.Package || Package), "_init_", [aPackageName]);})]);
  2935. return self;},
  2936. args: ["aPackageName", "aPrefix"],
  2937. source: "fetch: aPackageName prefix: aPrefix\x0a\x09jQuery getScript: (aPrefix , aPackageName , '.js') onSuccess: [ Package init: aPackageName ]",
  2938. messageSends: ["getScript:onSuccess:", ",", "init:"],
  2939. referencedClasses: ["Package"]
  2940. }),
  2941. smalltalk.Package.klass);
  2942. smalltalk.addMethod(
  2943. "_init_",
  2944. smalltalk.method({
  2945. selector: "init:",
  2946. category: 'loading-storing',
  2947. fn: function (aPackageName){
  2948. var self=this;
  2949. (function($rec){smalltalk.send($rec, "_do_", [(function(each){return smalltalk.init(each);})]);return smalltalk.send($rec, "_do_", [(function(each){return smalltalk.send(each, "_initialize", []);})]);})(smalltalk.send(smalltalk.send((typeof smalltalk == 'undefined' ? nil : smalltalk), "_classes", []), "_select_", [(function(each){return each.pkg.pkgName == aPackageName;})]));
  2950. return self;},
  2951. args: ["aPackageName"],
  2952. source: "init: aPackageName\x0a\x09(smalltalk classes select: [ :each | <each.pkg.pkgName == aPackageName> ])\x0a\x09\x09do: [ :each | <smalltalk.init(each)> ];\x0a\x09\x09do: [ :each | each initialize ]",
  2953. messageSends: ["do:", "initialize", "select:", "classes"],
  2954. referencedClasses: []
  2955. }),
  2956. smalltalk.Package.klass);
  2957. smalltalk.addMethod(
  2958. "_named_",
  2959. smalltalk.method({
  2960. selector: "named:",
  2961. category: 'not yet classified',
  2962. fn: function (aPackageName){
  2963. var self=this;
  2964. return smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_packageAt_", [aPackageName]);
  2965. return self;},
  2966. args: ["aPackageName"],
  2967. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  2968. messageSends: ["packageAt:", "current"],
  2969. referencedClasses: ["Smalltalk"]
  2970. }),
  2971. smalltalk.Package.klass);
  2972. smalltalk.addMethod(
  2973. "_named_ifAbsent_",
  2974. smalltalk.method({
  2975. selector: "named:ifAbsent:",
  2976. category: 'not yet classified',
  2977. fn: function (aPackageName, aBlock){
  2978. var self=this;
  2979. return smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  2980. return self;},
  2981. args: ["aPackageName", "aBlock"],
  2982. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  2983. messageSends: ["packageAt:ifAbsent:", "current"],
  2984. referencedClasses: ["Smalltalk"]
  2985. }),
  2986. smalltalk.Package.klass);
  2987. smalltalk.addMethod(
  2988. "_resetCommitPaths",
  2989. smalltalk.method({
  2990. selector: "resetCommitPaths",
  2991. category: 'commit paths',
  2992. fn: function (){
  2993. var self=this;
  2994. (self['@defaultCommitPathJs']=nil);
  2995. (self['@defaultCommitPathSt']=nil);
  2996. return self;},
  2997. args: [],
  2998. source: "resetCommitPaths\x0a defaultCommitPathJs := nil.\x0a defaultCommitPathSt := nil.",
  2999. messageSends: [],
  3000. referencedClasses: []
  3001. }),
  3002. smalltalk.Package.klass);
  3003. smalltalk.addMethod(
  3004. "_sortedClasses_",
  3005. smalltalk.method({
  3006. selector: "sortedClasses:",
  3007. category: 'sorting',
  3008. fn: function (classes){
  3009. var self=this;
  3010. var children=nil;
  3011. var others=nil;
  3012. var nodes=nil;
  3013. var expandedClasses=nil;
  3014. (children=[]);
  3015. (others=[]);
  3016. smalltalk.send(classes, "_do_", [(function(each){return ((($receiver = smalltalk.send(classes, "_includes_", [smalltalk.send(each, "_superclass", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(children, "_add_", [each]);})() : (function(){return smalltalk.send(others, "_add_", [each]);})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return smalltalk.send(children, "_add_", [each]);}), (function(){return smalltalk.send(others, "_add_", [each]);})]));})]);
  3017. (nodes=smalltalk.send(children, "_collect_", [(function(each){return smalltalk.send((smalltalk.ClassSorterNode || ClassSorterNode), "_on_classes_level_", [each, others, (0)]);})]));
  3018. (nodes=smalltalk.send(nodes, "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(smalltalk.send(a, "_theClass", []), "_name", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", [])]));})]));
  3019. (expandedClasses=smalltalk.send((smalltalk.Array || Array), "_new", []));
  3020. smalltalk.send(nodes, "_do_", [(function(aNode){return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);})]);
  3021. return expandedClasses;
  3022. return self;},
  3023. args: ["classes"],
  3024. 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",
  3025. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  3026. referencedClasses: ["ClassSorterNode", "Array"]
  3027. }),
  3028. smalltalk.Package.klass);
  3029. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  3030. 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."
  3031. smalltalk.addMethod(
  3032. "__star",
  3033. smalltalk.method({
  3034. selector: "*",
  3035. category: 'arithmetic',
  3036. fn: function (aPoint){
  3037. var self=this;
  3038. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver *smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3039. return self;},
  3040. args: ["aPoint"],
  3041. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  3042. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  3043. referencedClasses: ["Point"]
  3044. }),
  3045. smalltalk.Point);
  3046. smalltalk.addMethod(
  3047. "__plus",
  3048. smalltalk.method({
  3049. selector: "+",
  3050. category: 'arithmetic',
  3051. fn: function (aPoint){
  3052. var self=this;
  3053. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3054. return self;},
  3055. args: ["aPoint"],
  3056. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  3057. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  3058. referencedClasses: ["Point"]
  3059. }),
  3060. smalltalk.Point);
  3061. smalltalk.addMethod(
  3062. "__minus",
  3063. smalltalk.method({
  3064. selector: "-",
  3065. category: 'arithmetic',
  3066. fn: function (aPoint){
  3067. var self=this;
  3068. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver -smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3069. return self;},
  3070. args: ["aPoint"],
  3071. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  3072. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  3073. referencedClasses: ["Point"]
  3074. }),
  3075. smalltalk.Point);
  3076. smalltalk.addMethod(
  3077. "__slash",
  3078. smalltalk.method({
  3079. selector: "/",
  3080. category: 'arithmetic',
  3081. fn: function (aPoint){
  3082. var self=this;
  3083. return smalltalk.send((smalltalk.Point || Point), "_x_y_", [((($receiver = smalltalk.send(self, "_x", [])).klass === smalltalk.Number) ? $receiver /smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", []) : smalltalk.send($receiver, "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])])), ((($receiver = smalltalk.send(self, "_y", [])).klass === smalltalk.Number) ? $receiver /smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", []) : smalltalk.send($receiver, "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])]))]);
  3084. return self;},
  3085. args: ["aPoint"],
  3086. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  3087. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  3088. referencedClasses: ["Point"]
  3089. }),
  3090. smalltalk.Point);
  3091. smalltalk.addMethod(
  3092. "__eq",
  3093. smalltalk.method({
  3094. selector: "=",
  3095. category: 'arithmetic',
  3096. fn: function (aPoint){
  3097. var self=this;
  3098. return smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_class", []), "__eq", [smalltalk.send(self, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_x", []), "__eq", [smalltalk.send(self, "_x", [])]), "_&", [smalltalk.send(smalltalk.send(aPoint, "_y", []), "__eq", [smalltalk.send(self, "_y", [])])]);})]);
  3099. return self;},
  3100. args: ["aPoint"],
  3101. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  3102. messageSends: ["and:", "=", "class", "&", "x", "y"],
  3103. referencedClasses: []
  3104. }),
  3105. smalltalk.Point);
  3106. smalltalk.addMethod(
  3107. "_asPoint",
  3108. smalltalk.method({
  3109. selector: "asPoint",
  3110. category: 'converting',
  3111. fn: function (){
  3112. var self=this;
  3113. return self;
  3114. return self;},
  3115. args: [],
  3116. source: "asPoint\x0a\x09^self",
  3117. messageSends: [],
  3118. referencedClasses: []
  3119. }),
  3120. smalltalk.Point);
  3121. smalltalk.addMethod(
  3122. "_printString",
  3123. smalltalk.method({
  3124. selector: "printString",
  3125. category: 'printing',
  3126. fn: function (){
  3127. var self=this;
  3128. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@x'], "_printString", []), "__comma", ["@"])]);((($receiver = smalltalk.send(smalltalk.send(self['@y'], "_notNil", []), "_and_", [(function(){return smalltalk.send(self['@y'], "_negative", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(stream, "_space", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(stream, "_space", []);})]));return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self['@y'], "_printString", [])]);})]);
  3129. return self;},
  3130. args: [],
  3131. source: "printString\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09stream nextPutAll: x printString, '@'.\x0a\x09\x09(y notNil and: [y negative])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09\x09stream space].\x0a\x09\x09stream nextPutAll: y printString]",
  3132. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "ifTrue:", "and:", "notNil", "negative", "space"],
  3133. referencedClasses: ["String"]
  3134. }),
  3135. smalltalk.Point);
  3136. smalltalk.addMethod(
  3137. "_translateBy_",
  3138. smalltalk.method({
  3139. selector: "translateBy:",
  3140. category: 'transforming',
  3141. fn: function (delta){
  3142. var self=this;
  3143. return smalltalk.send(((($receiver = smalltalk.send(delta, "_x", [])).klass === smalltalk.Number) ? $receiver +self['@x'] : smalltalk.send($receiver, "__plus", [self['@x']])), "__at", [((($receiver = smalltalk.send(delta, "_y", [])).klass === smalltalk.Number) ? $receiver +self['@y'] : smalltalk.send($receiver, "__plus", [self['@y']]))]);
  3144. return self;},
  3145. args: ["delta"],
  3146. source: "translateBy: delta \x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  3147. messageSends: ["@", "+", "x", "y"],
  3148. referencedClasses: []
  3149. }),
  3150. smalltalk.Point);
  3151. smalltalk.addMethod(
  3152. "_x",
  3153. smalltalk.method({
  3154. selector: "x",
  3155. category: 'accessing',
  3156. fn: function (){
  3157. var self=this;
  3158. return self['@x'];
  3159. return self;},
  3160. args: [],
  3161. source: "x\x0a\x09^x",
  3162. messageSends: [],
  3163. referencedClasses: []
  3164. }),
  3165. smalltalk.Point);
  3166. smalltalk.addMethod(
  3167. "_x_",
  3168. smalltalk.method({
  3169. selector: "x:",
  3170. category: 'accessing',
  3171. fn: function (aNumber){
  3172. var self=this;
  3173. (self['@x']=aNumber);
  3174. return self;},
  3175. args: ["aNumber"],
  3176. source: "x: aNumber\x0a\x09x := aNumber",
  3177. messageSends: [],
  3178. referencedClasses: []
  3179. }),
  3180. smalltalk.Point);
  3181. smalltalk.addMethod(
  3182. "_y",
  3183. smalltalk.method({
  3184. selector: "y",
  3185. category: 'accessing',
  3186. fn: function (){
  3187. var self=this;
  3188. return self['@y'];
  3189. return self;},
  3190. args: [],
  3191. source: "y\x0a\x09^y",
  3192. messageSends: [],
  3193. referencedClasses: []
  3194. }),
  3195. smalltalk.Point);
  3196. smalltalk.addMethod(
  3197. "_y_",
  3198. smalltalk.method({
  3199. selector: "y:",
  3200. category: 'accessing',
  3201. fn: function (aNumber){
  3202. var self=this;
  3203. (self['@y']=aNumber);
  3204. return self;},
  3205. args: ["aNumber"],
  3206. source: "y: aNumber\x0a\x09y := aNumber",
  3207. messageSends: [],
  3208. referencedClasses: []
  3209. }),
  3210. smalltalk.Point);
  3211. smalltalk.addMethod(
  3212. "_x_y_",
  3213. smalltalk.method({
  3214. selector: "x:y:",
  3215. category: 'instance creation',
  3216. fn: function (aNumber, anotherNumber){
  3217. var self=this;
  3218. return (function($rec){smalltalk.send($rec, "_x_", [aNumber]);smalltalk.send($rec, "_y_", [anotherNumber]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  3219. return self;},
  3220. args: ["aNumber", "anotherNumber"],
  3221. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  3222. messageSends: ["x:", "y:", "yourself", "new"],
  3223. referencedClasses: []
  3224. }),
  3225. smalltalk.Point.klass);
  3226. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  3227. 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'`."
  3228. smalltalk.addMethod(
  3229. "_next",
  3230. smalltalk.method({
  3231. selector: "next",
  3232. category: 'accessing',
  3233. fn: function (){
  3234. var self=this;
  3235. return Math.random();
  3236. return self;},
  3237. args: [],
  3238. source: "next\x0a\x09<return Math.random()>",
  3239. messageSends: [],
  3240. referencedClasses: []
  3241. }),
  3242. smalltalk.Random);
  3243. smalltalk.addMethod(
  3244. "_next_",
  3245. smalltalk.method({
  3246. selector: "next:",
  3247. category: 'accessing',
  3248. fn: function (anInteger){
  3249. var self=this;
  3250. return smalltalk.send(smalltalk.send((1), "_to_", [anInteger]), "_collect_", [(function(each){return smalltalk.send(self, "_next", []);})]);
  3251. return self;},
  3252. args: ["anInteger"],
  3253. source: "next: anInteger\x0a ^(1 to: anInteger) collect: [:each | self next]",
  3254. messageSends: ["collect:", "to:", "next"],
  3255. referencedClasses: []
  3256. }),
  3257. smalltalk.Random);
  3258. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  3259. 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"
  3260. smalltalk.addMethod(
  3261. "_at_",
  3262. smalltalk.method({
  3263. selector: "at:",
  3264. category: 'accessing',
  3265. fn: function (aString){
  3266. var self=this;
  3267. return self[aString];
  3268. return self;},
  3269. args: ["aString"],
  3270. source: "at: aString\x0a\x09<return self[aString]>",
  3271. messageSends: [],
  3272. referencedClasses: []
  3273. }),
  3274. smalltalk.Smalltalk);
  3275. smalltalk.addMethod(
  3276. "_basicParse_",
  3277. smalltalk.method({
  3278. selector: "basicParse:",
  3279. category: 'accessing',
  3280. fn: function (aString){
  3281. var self=this;
  3282. return smalltalk.parser.parse(aString);
  3283. return self;},
  3284. args: ["aString"],
  3285. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  3286. messageSends: [],
  3287. referencedClasses: []
  3288. }),
  3289. smalltalk.Smalltalk);
  3290. smalltalk.addMethod(
  3291. "_classes",
  3292. smalltalk.method({
  3293. selector: "classes",
  3294. category: 'accessing',
  3295. fn: function (){
  3296. var self=this;
  3297. return self.classes();
  3298. return self;},
  3299. args: [],
  3300. source: "classes\x0a\x09<return self.classes()>",
  3301. messageSends: [],
  3302. referencedClasses: []
  3303. }),
  3304. smalltalk.Smalltalk);
  3305. smalltalk.addMethod(
  3306. "_createPackage_",
  3307. smalltalk.method({
  3308. selector: "createPackage:",
  3309. category: 'private',
  3310. fn: function (packageName){
  3311. var self=this;
  3312. return smalltalk.addPackage(packageName, nil);
  3313. return self;},
  3314. args: ["packageName"],
  3315. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x0a <return smalltalk.addPackage(packageName, nil)>",
  3316. messageSends: [],
  3317. referencedClasses: []
  3318. }),
  3319. smalltalk.Smalltalk);
  3320. smalltalk.addMethod(
  3321. "_createPackage_properties_",
  3322. smalltalk.method({
  3323. selector: "createPackage:properties:",
  3324. category: 'private',
  3325. fn: function (packageName, aDict){
  3326. var self=this;
  3327. var object=nil;
  3328. object = {};;
  3329. smalltalk.send(aDict, "_keysAndValuesDo_", [(function(key, value){return object[key] = value;})]);
  3330. return smalltalk.addPackage(packageName, object);
  3331. return self;},
  3332. args: ["packageName", "aDict"],
  3333. source: "createPackage: packageName properties: aDict\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x0a\x09| object |\x0a\x09<object = {};>.\x0a\x09aDict keysAndValuesDo: [:key :value |\x0a\x09\x09<object[key] = value>.\x0a\x09].\x0a <return smalltalk.addPackage(packageName, object)>",
  3334. messageSends: ["keysAndValuesDo:"],
  3335. referencedClasses: []
  3336. }),
  3337. smalltalk.Smalltalk);
  3338. smalltalk.addMethod(
  3339. "_deletePackage_",
  3340. smalltalk.method({
  3341. selector: "deletePackage:",
  3342. category: 'private',
  3343. fn: function (packageName){
  3344. var self=this;
  3345. delete smalltalk.packages[packageName];
  3346. return self;},
  3347. args: ["packageName"],
  3348. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a <delete smalltalk.packages[packageName]>",
  3349. messageSends: [],
  3350. referencedClasses: []
  3351. }),
  3352. smalltalk.Smalltalk);
  3353. smalltalk.addMethod(
  3354. "_packageAt_",
  3355. smalltalk.method({
  3356. selector: "packageAt:",
  3357. category: 'packages',
  3358. fn: function (packageName){
  3359. var self=this;
  3360. return self.packages[packageName];
  3361. return self;},
  3362. args: ["packageName"],
  3363. source: "packageAt: packageName\x0a <return self.packages[packageName]>",
  3364. messageSends: [],
  3365. referencedClasses: []
  3366. }),
  3367. smalltalk.Smalltalk);
  3368. smalltalk.addMethod(
  3369. "_packageAt_ifAbsent_",
  3370. smalltalk.method({
  3371. selector: "packageAt:ifAbsent:",
  3372. category: 'packages',
  3373. fn: function (packageName, aBlock){
  3374. var self=this;
  3375. return smalltalk.send(smalltalk.send(self, "_packageAt_", [packageName]), "_ifNil_", [aBlock]);
  3376. return self;},
  3377. args: ["packageName", "aBlock"],
  3378. source: "packageAt: packageName ifAbsent: aBlock\x0a ^(self packageAt: packageName) ifNil: aBlock",
  3379. messageSends: ["ifNil:", "packageAt:"],
  3380. referencedClasses: []
  3381. }),
  3382. smalltalk.Smalltalk);
  3383. smalltalk.addMethod(
  3384. "_packages",
  3385. smalltalk.method({
  3386. selector: "packages",
  3387. category: 'packages',
  3388. fn: function (){
  3389. var self=this;
  3390. return self.packages.all();
  3391. return self;},
  3392. args: [],
  3393. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  3394. messageSends: [],
  3395. referencedClasses: []
  3396. }),
  3397. smalltalk.Smalltalk);
  3398. smalltalk.addMethod(
  3399. "_parse_",
  3400. smalltalk.method({
  3401. selector: "parse:",
  3402. category: 'accessing',
  3403. fn: function (aString){
  3404. var self=this;
  3405. var result=nil;
  3406. smalltalk.send(self, "_try_catch_", [(function(){return (result=smalltalk.send(self, "_basicParse_", [aString]));}), (function(ex){return smalltalk.send(smalltalk.send(self, "_parseError_parsing_", [ex, aString]), "_signal", []);})]);
  3407. return result;
  3408. return self;},
  3409. args: ["aString"],
  3410. source: "parse: aString\x0a\x09| result | \x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  3411. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  3412. referencedClasses: []
  3413. }),
  3414. smalltalk.Smalltalk);
  3415. smalltalk.addMethod(
  3416. "_parseError_parsing_",
  3417. smalltalk.method({
  3418. selector: "parseError:parsing:",
  3419. category: 'accessing',
  3420. fn: function (anException, aString){
  3421. var self=this;
  3422. var row=nil;
  3423. var col=nil;
  3424. var message=nil;
  3425. var lines=nil;
  3426. var badLine=nil;
  3427. var code=nil;
  3428. row = anException.line;
  3429. col = anException.column;
  3430. message = anException.message;;
  3431. (lines=smalltalk.send(aString, "_lines", []));
  3432. (badLine=smalltalk.send(lines, "_at_", [row]));
  3433. (badLine=smalltalk.send(smalltalk.send(smalltalk.send(badLine, "_copyFrom_to_", [(1), ((($receiver = col).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]))]), "__comma", [" ===>"]), "__comma", [smalltalk.send(badLine, "_copyFrom_to_", [col, smalltalk.send(badLine, "_size", [])])]));
  3434. smalltalk.send(lines, "_at_put_", [row, badLine]);
  3435. (code=smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(s){return smalltalk.send(lines, "_withIndexDo_", [(function(l, i){return smalltalk.send(s, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(i, "_asString", []), "__comma", [": "]), "__comma", [l]), "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])])]);})]);})]));
  3436. return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_messageText_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("Parse error on line ", "__comma", [row]), "__comma", [" column "]), "__comma", [col]), "__comma", [" : "]), "__comma", [message]), "__comma", [" Below is code with line numbers and ===> marker inserted:"]), "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])]), "__comma", [code])]);
  3437. return self;},
  3438. args: ["anException", "aString"],
  3439. source: "parseError: anException parsing: aString\x0a\x09| row col message lines badLine code |\x0a\x09<row = anException.line;\x0a\x09col = anException.column;\x0a\x09message = anException.message;>.\x0a\x09lines := aString lines.\x0a\x09badLine := lines at: row.\x0a\x09badLine := (badLine copyFrom: 1 to: col - 1), ' ===>', (badLine copyFrom: col to: badLine size).\x0a\x09lines at: row put: badLine.\x0a\x09code := String streamContents: [:s |\x0a lines withIndexDo: [:l :i |\x0a s nextPutAll: i asString, ': ', l, String lf]].\x0a\x09^ Error new messageText: ('Parse error on line ' , row , ' column ' , col , ' : ' , message , ' Below is code with line numbers and ===> marker inserted:' , String lf, code)",
  3440. messageSends: ["lines", "at:", ",", "copyFrom:to:", "-", "size", "at:put:", "streamContents:", "withIndexDo:", "nextPutAll:", "asString", "lf", "messageText:", "new"],
  3441. referencedClasses: ["String", "Error"]
  3442. }),
  3443. smalltalk.Smalltalk);
  3444. smalltalk.addMethod(
  3445. "_readJSObject_",
  3446. smalltalk.method({
  3447. selector: "readJSObject:",
  3448. category: 'accessing',
  3449. fn: function (anObject){
  3450. var self=this;
  3451. return self.readJSObject(anObject);
  3452. return self;},
  3453. args: ["anObject"],
  3454. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  3455. messageSends: [],
  3456. referencedClasses: []
  3457. }),
  3458. smalltalk.Smalltalk);
  3459. smalltalk.addMethod(
  3460. "_removeClass_",
  3461. smalltalk.method({
  3462. selector: "removeClass:",
  3463. category: 'classes',
  3464. fn: function (aClass){
  3465. var self=this;
  3466. ((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);})]));
  3467. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);})]);
  3468. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);})]);
  3469. smalltalk.send(self, "_basicDelete_", [smalltalk.send(aClass, "_name", [])]);
  3470. return self;},
  3471. args: ["aClass"],
  3472. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09aClass removeCompiledMethod: each].\x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09aClass class removeCompiledMethod: each].\x0a\x09self basicDelete: aClass name",
  3473. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "do:", "values", "methodDictionary", "removeCompiledMethod:", "class", "basicDelete:", "name"],
  3474. referencedClasses: []
  3475. }),
  3476. smalltalk.Smalltalk);
  3477. smalltalk.addMethod(
  3478. "_removePackage_",
  3479. smalltalk.method({
  3480. selector: "removePackage:",
  3481. category: 'packages',
  3482. fn: function (packageName){
  3483. var self=this;
  3484. var pkg=nil;
  3485. (pkg=smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, (function(){return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);})]));
  3486. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [(function(each){return smalltalk.send(self, "_removeClass_", [each]);})]);
  3487. smalltalk.send(self, "_deletePackage_", [packageName]);
  3488. return self;},
  3489. args: ["packageName"],
  3490. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09pkg classes do: [:each |\x0a \x09self removeClass: each].\x0a\x09self deletePackage: packageName",
  3491. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
  3492. referencedClasses: []
  3493. }),
  3494. smalltalk.Smalltalk);
  3495. smalltalk.addMethod(
  3496. "_renamePackage_to_",
  3497. smalltalk.method({
  3498. selector: "renamePackage:to:",
  3499. category: 'packages',
  3500. fn: function (packageName, newName){
  3501. var self=this;
  3502. var pkg=nil;
  3503. (pkg=smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, (function(){return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);})]));
  3504. (($receiver = smalltalk.send(self, "_packageAt_", [newName])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);})() : nil;
  3505. smalltalk.packages[newName] = smalltalk.packages[packageName];
  3506. smalltalk.send(pkg, "_name_", [newName]);
  3507. smalltalk.send(self, "_deletePackage_", [packageName]);
  3508. return self;},
  3509. args: ["packageName", "newName"],
  3510. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09<smalltalk.packages[newName] = smalltalk.packages[packageName]>.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  3511. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "deletePackage:"],
  3512. referencedClasses: []
  3513. }),
  3514. smalltalk.Smalltalk);
  3515. smalltalk.addMethod(
  3516. "_reservedWords",
  3517. smalltalk.method({
  3518. selector: "reservedWords",
  3519. category: 'accessing',
  3520. fn: function (){
  3521. var self=this;
  3522. return self.reservedWords;
  3523. return self;},
  3524. args: [],
  3525. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  3526. messageSends: [],
  3527. referencedClasses: []
  3528. }),
  3529. smalltalk.Smalltalk);
  3530. smalltalk.addMethod(
  3531. "_send_to_arguments_",
  3532. smalltalk.method({
  3533. selector: "send:to:arguments:",
  3534. category: 'accessing',
  3535. fn: function (aSelector, anObject, aCollection){
  3536. var self=this;
  3537. var selector=nil;
  3538. (selector=smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []));
  3539. self.send(anObject, selector, aCollection);
  3540. return self;},
  3541. args: ["aSelector", "anObject", "aCollection"],
  3542. source: "send: aSelector to: anObject arguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSelector asString asSelector.\x0a\x09<self.send(anObject, selector, aCollection)>",
  3543. messageSends: ["asSelector", "asString"],
  3544. referencedClasses: []
  3545. }),
  3546. smalltalk.Smalltalk);
  3547. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  3548. smalltalk.addMethod(
  3549. "_current",
  3550. smalltalk.method({
  3551. selector: "current",
  3552. category: 'accessing',
  3553. fn: function (){
  3554. var self=this;
  3555. return smalltalk;
  3556. return self;},
  3557. args: [],
  3558. source: "current\x0a\x09<return smalltalk>",
  3559. messageSends: [],
  3560. referencedClasses: []
  3561. }),
  3562. smalltalk.Smalltalk.klass);
  3563. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  3564. 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."
  3565. smalltalk.addMethod(
  3566. "_asJSON",
  3567. smalltalk.method({
  3568. selector: "asJSON",
  3569. category: 'converting',
  3570. fn: function (){
  3571. var self=this;
  3572. return (typeof null == 'undefined' ? nil : null);
  3573. return self;},
  3574. args: [],
  3575. source: "asJSON\x0a\x09^null",
  3576. messageSends: [],
  3577. referencedClasses: []
  3578. }),
  3579. smalltalk.UndefinedObject);
  3580. smalltalk.addMethod(
  3581. "_deepCopy",
  3582. smalltalk.method({
  3583. selector: "deepCopy",
  3584. category: 'copying',
  3585. fn: function (){
  3586. var self=this;
  3587. return self;
  3588. return self;},
  3589. args: [],
  3590. source: "deepCopy\x0a\x09^self",
  3591. messageSends: [],
  3592. referencedClasses: []
  3593. }),
  3594. smalltalk.UndefinedObject);
  3595. smalltalk.addMethod(
  3596. "_ifNil_",
  3597. smalltalk.method({
  3598. selector: "ifNil:",
  3599. category: 'testing',
  3600. fn: function (aBlock){
  3601. var self=this;
  3602. return smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, (function(){return nil;})]);
  3603. return self;},
  3604. args: ["aBlock"],
  3605. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  3606. messageSends: ["ifNil:ifNotNil:"],
  3607. referencedClasses: []
  3608. }),
  3609. smalltalk.UndefinedObject);
  3610. smalltalk.addMethod(
  3611. "_ifNil_ifNotNil_",
  3612. smalltalk.method({
  3613. selector: "ifNil:ifNotNil:",
  3614. category: 'testing',
  3615. fn: function (aBlock, anotherBlock){
  3616. var self=this;
  3617. return smalltalk.send(aBlock, "_value", []);
  3618. return self;},
  3619. args: ["aBlock", "anotherBlock"],
  3620. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  3621. messageSends: ["value"],
  3622. referencedClasses: []
  3623. }),
  3624. smalltalk.UndefinedObject);
  3625. smalltalk.addMethod(
  3626. "_ifNotNil_",
  3627. smalltalk.method({
  3628. selector: "ifNotNil:",
  3629. category: 'testing',
  3630. fn: function (aBlock){
  3631. var self=this;
  3632. return self;
  3633. return self;},
  3634. args: ["aBlock"],
  3635. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  3636. messageSends: [],
  3637. referencedClasses: []
  3638. }),
  3639. smalltalk.UndefinedObject);
  3640. smalltalk.addMethod(
  3641. "_ifNotNil_ifNil_",
  3642. smalltalk.method({
  3643. selector: "ifNotNil:ifNil:",
  3644. category: 'testing',
  3645. fn: function (aBlock, anotherBlock){
  3646. var self=this;
  3647. return smalltalk.send(anotherBlock, "_value", []);
  3648. return self;},
  3649. args: ["aBlock", "anotherBlock"],
  3650. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  3651. messageSends: ["value"],
  3652. referencedClasses: []
  3653. }),
  3654. smalltalk.UndefinedObject);
  3655. smalltalk.addMethod(
  3656. "_isNil",
  3657. smalltalk.method({
  3658. selector: "isNil",
  3659. category: 'testing',
  3660. fn: function (){
  3661. var self=this;
  3662. return true;
  3663. return self;},
  3664. args: [],
  3665. source: "isNil\x0a\x09^true",
  3666. messageSends: [],
  3667. referencedClasses: []
  3668. }),
  3669. smalltalk.UndefinedObject);
  3670. smalltalk.addMethod(
  3671. "_notNil",
  3672. smalltalk.method({
  3673. selector: "notNil",
  3674. category: 'testing',
  3675. fn: function (){
  3676. var self=this;
  3677. return false;
  3678. return self;},
  3679. args: [],
  3680. source: "notNil\x0a\x09^false",
  3681. messageSends: [],
  3682. referencedClasses: []
  3683. }),
  3684. smalltalk.UndefinedObject);
  3685. smalltalk.addMethod(
  3686. "_printString",
  3687. smalltalk.method({
  3688. selector: "printString",
  3689. category: 'printing',
  3690. fn: function (){
  3691. var self=this;
  3692. return "nil";
  3693. return self;},
  3694. args: [],
  3695. source: "printString\x0a ^'nil'",
  3696. messageSends: [],
  3697. referencedClasses: []
  3698. }),
  3699. smalltalk.UndefinedObject);
  3700. smalltalk.addMethod(
  3701. "_shallowCopy",
  3702. smalltalk.method({
  3703. selector: "shallowCopy",
  3704. category: 'copying',
  3705. fn: function (){
  3706. var self=this;
  3707. return self;
  3708. return self;},
  3709. args: [],
  3710. source: "shallowCopy\x0a\x09^self",
  3711. messageSends: [],
  3712. referencedClasses: []
  3713. }),
  3714. smalltalk.UndefinedObject);
  3715. smalltalk.addMethod(
  3716. "_subclass_instanceVariableNames_",
  3717. smalltalk.method({
  3718. selector: "subclass:instanceVariableNames:",
  3719. category: 'class creation',
  3720. fn: function (aString, anotherString){
  3721. var self=this;
  3722. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  3723. return self;},
  3724. args: ["aString", "anotherString"],
  3725. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  3726. messageSends: ["subclass:instanceVariableNames:package:"],
  3727. referencedClasses: []
  3728. }),
  3729. smalltalk.UndefinedObject);
  3730. smalltalk.addMethod(
  3731. "_subclass_instanceVariableNames_category_",
  3732. smalltalk.method({
  3733. selector: "subclass:instanceVariableNames:category:",
  3734. category: 'class creation',
  3735. fn: function (aString, aString2, aString3){
  3736. var self=this;
  3737. smalltalk.send(self, "_deprecatedAPI", []);
  3738. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  3739. return self;},
  3740. args: ["aString", "aString2", "aString3"],
  3741. 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",
  3742. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  3743. referencedClasses: []
  3744. }),
  3745. smalltalk.UndefinedObject);
  3746. smalltalk.addMethod(
  3747. "_subclass_instanceVariableNames_package_",
  3748. smalltalk.method({
  3749. selector: "subclass:instanceVariableNames:package:",
  3750. category: 'class creation',
  3751. fn: function (aString, aString2, aString3){
  3752. var self=this;
  3753. return smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
  3754. return self;},
  3755. args: ["aString", "aString2", "aString3"],
  3756. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString instanceVariableNames: aString2 package: aString3",
  3757. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new"],
  3758. referencedClasses: ["ClassBuilder"]
  3759. }),
  3760. smalltalk.UndefinedObject);
  3761. smalltalk.addMethod(
  3762. "_new",
  3763. smalltalk.method({
  3764. selector: "new",
  3765. category: 'instance creation',
  3766. fn: function (){
  3767. var self=this;
  3768. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  3769. return self;},
  3770. args: [],
  3771. source: "new\x0a\x09 self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  3772. messageSends: ["error:"],
  3773. referencedClasses: []
  3774. }),
  3775. smalltalk.UndefinedObject.klass);