1
0

Kernel-Objects.deploy.js 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108
  1. smalltalk.addPackage('Kernel-Objects', {});
  2. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  3. smalltalk.addMethod(
  4. "__minus_gt",
  5. smalltalk.method({
  6. selector: "->",
  7. fn: function (anObject) {
  8. var self = this;
  9. return smalltalk.send(smalltalk.Association || Association, "_key_value_", [self, anObject]);
  10. return self;
  11. }
  12. }),
  13. smalltalk.Object);
  14. smalltalk.addMethod(
  15. "__eq",
  16. smalltalk.method({
  17. selector: "=",
  18. fn: function (anObject) {
  19. var self = this;
  20. return smalltalk.send(self, "__eq_eq", [anObject]);
  21. return self;
  22. }
  23. }),
  24. smalltalk.Object);
  25. smalltalk.addMethod(
  26. "__eq_eq",
  27. smalltalk.method({
  28. selector: "==",
  29. fn: function (anObject) {
  30. var self = this;
  31. return smalltalk.send(smalltalk.send(self, "_identityHash", []), "__eq", [smalltalk.send(anObject, "_identityHash", [])]);
  32. return self;
  33. }
  34. }),
  35. smalltalk.Object);
  36. smalltalk.addMethod(
  37. "_asJSON",
  38. smalltalk.method({
  39. selector: "asJSON",
  40. fn: function () {
  41. var self = this;
  42. var variables = nil;
  43. variables = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  44. 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", [])]);}]);
  45. return variables;
  46. return self;
  47. }
  48. }),
  49. smalltalk.Object);
  50. smalltalk.addMethod(
  51. "_asJSONString",
  52. smalltalk.method({
  53. selector: "asJSONString",
  54. fn: function () {
  55. var self = this;
  56. return smalltalk.send(smalltalk.JSON || JSON, "_stringify_", [smalltalk.send(self, "_asJSON", [])]);
  57. return self;
  58. }
  59. }),
  60. smalltalk.Object);
  61. smalltalk.addMethod(
  62. "_asJavascript",
  63. smalltalk.method({
  64. selector: "asJavascript",
  65. fn: function () {
  66. var self = this;
  67. return smalltalk.send(self, "_asString", []);
  68. return self;
  69. }
  70. }),
  71. smalltalk.Object);
  72. smalltalk.addMethod(
  73. "_asString",
  74. smalltalk.method({
  75. selector: "asString",
  76. fn: function () {
  77. var self = this;
  78. return smalltalk.send(self, "_printString", []);
  79. return self;
  80. }
  81. }),
  82. smalltalk.Object);
  83. smalltalk.addMethod(
  84. "_basicAt_",
  85. smalltalk.method({
  86. selector: "basicAt:",
  87. fn: function (aString) {
  88. var self = this;
  89. return self[aString];
  90. return self;
  91. }
  92. }),
  93. smalltalk.Object);
  94. smalltalk.addMethod(
  95. "_basicAt_put_",
  96. smalltalk.method({
  97. selector: "basicAt:put:",
  98. fn: function (aString, anObject) {
  99. var self = this;
  100. return self[aString] = anObject;
  101. return self;
  102. }
  103. }),
  104. smalltalk.Object);
  105. smalltalk.addMethod(
  106. "_basicDelete_",
  107. smalltalk.method({
  108. selector: "basicDelete:",
  109. fn: function (aString) {
  110. var self = this;
  111. delete self[aString];
  112. return aString;
  113. return self;
  114. }
  115. }),
  116. smalltalk.Object);
  117. smalltalk.addMethod(
  118. "_basicPerform_",
  119. smalltalk.method({
  120. selector: "basicPerform:",
  121. fn: function (aSymbol) {
  122. var self = this;
  123. return smalltalk.send(self, "_basicPerform_withArguments_", [aSymbol, []]);
  124. return self;
  125. }
  126. }),
  127. smalltalk.Object);
  128. smalltalk.addMethod(
  129. "_basicPerform_withArguments_",
  130. smalltalk.method({
  131. selector: "basicPerform:withArguments:",
  132. fn: function (aSymbol, aCollection) {
  133. var self = this;
  134. return self[aSymbol].apply(self, aCollection);
  135. return self;
  136. }
  137. }),
  138. smalltalk.Object);
  139. smalltalk.addMethod(
  140. "_class",
  141. smalltalk.method({
  142. selector: "class",
  143. fn: function () {
  144. var self = this;
  145. return self.klass;
  146. return self;
  147. }
  148. }),
  149. smalltalk.Object);
  150. smalltalk.addMethod(
  151. "_copy",
  152. smalltalk.method({
  153. selector: "copy",
  154. fn: function () {
  155. var self = this;
  156. return smalltalk.send(smalltalk.send(self, "_shallowCopy", []), "_postCopy", []);
  157. return self;
  158. }
  159. }),
  160. smalltalk.Object);
  161. smalltalk.addMethod(
  162. "_deepCopy",
  163. smalltalk.method({
  164. selector: "deepCopy",
  165. fn: function () {
  166. var self = this;
  167. var copy = self.klass._new();
  168. for (var i in self) {
  169. if (/^@.+/.test(i)) {
  170. copy[i] = self[i]._deepCopy();
  171. }
  172. }
  173. return copy;
  174. return self;
  175. }
  176. }),
  177. smalltalk.Object);
  178. smalltalk.addMethod(
  179. "_deprecatedAPI",
  180. smalltalk.method({
  181. selector: "deprecatedAPI",
  182. fn: function () {
  183. var self = this;
  184. 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", [")"])]);
  185. return self;
  186. }
  187. }),
  188. smalltalk.Object);
  189. smalltalk.addMethod(
  190. "_doesNotUnderstand_",
  191. smalltalk.method({
  192. selector: "doesNotUnderstand:",
  193. fn: function (aMessage) {
  194. var self = this;
  195. (function ($rec) {smalltalk.send($rec, "_receiver_", [self]);smalltalk.send($rec, "_message_", [aMessage]);return smalltalk.send($rec, "_signal", []);}(smalltalk.send(smalltalk.MessageNotUnderstood || MessageNotUnderstood, "_new", [])));
  196. return self;
  197. }
  198. }),
  199. smalltalk.Object);
  200. smalltalk.addMethod(
  201. "_error_",
  202. smalltalk.method({
  203. selector: "error:",
  204. fn: function (aString) {
  205. var self = this;
  206. smalltalk.send(smalltalk.Error || Error, "_signal_", [aString]);
  207. return self;
  208. }
  209. }),
  210. smalltalk.Object);
  211. smalltalk.addMethod(
  212. "_halt",
  213. smalltalk.method({
  214. selector: "halt",
  215. fn: function () {
  216. var self = this;
  217. smalltalk.send(self, "_error_", ["Halt encountered"]);
  218. return self;
  219. }
  220. }),
  221. smalltalk.Object);
  222. smalltalk.addMethod(
  223. "_identityHash",
  224. smalltalk.method({
  225. selector: "identityHash",
  226. fn: function () {
  227. var self = this;
  228. var hash = self.identityHash;
  229. if (hash) {
  230. return hash;
  231. }
  232. hash = smalltalk.nextId();
  233. Object.defineProperty(self, "identityHash", {value: hash});
  234. return hash;
  235. return self;
  236. }
  237. }),
  238. smalltalk.Object);
  239. smalltalk.addMethod(
  240. "_ifNil_",
  241. smalltalk.method({
  242. selector: "ifNil:",
  243. fn: function (aBlock) {
  244. var self = this;
  245. return self;
  246. return self;
  247. }
  248. }),
  249. smalltalk.Object);
  250. smalltalk.addMethod(
  251. "_ifNil_ifNotNil_",
  252. smalltalk.method({
  253. selector: "ifNil:ifNotNil:",
  254. fn: function (aBlock, anotherBlock) {
  255. var self = this;
  256. return smalltalk.send(anotherBlock, "_value", []);
  257. return self;
  258. }
  259. }),
  260. smalltalk.Object);
  261. smalltalk.addMethod(
  262. "_ifNotNil_",
  263. smalltalk.method({
  264. selector: "ifNotNil:",
  265. fn: function (aBlock) {
  266. var self = this;
  267. return smalltalk.send(aBlock, "_value", []);
  268. return self;
  269. }
  270. }),
  271. smalltalk.Object);
  272. smalltalk.addMethod(
  273. "_ifNotNil_ifNil_",
  274. smalltalk.method({
  275. selector: "ifNotNil:ifNil:",
  276. fn: function (aBlock, anotherBlock) {
  277. var self = this;
  278. return smalltalk.send(aBlock, "_value", []);
  279. return self;
  280. }
  281. }),
  282. smalltalk.Object);
  283. smalltalk.addMethod(
  284. "_initialize",
  285. smalltalk.method({
  286. selector: "initialize",
  287. fn: function () {
  288. var self = this;
  289. return self;
  290. }
  291. }),
  292. smalltalk.Object);
  293. smalltalk.addMethod(
  294. "_instVarAt_",
  295. smalltalk.method({
  296. selector: "instVarAt:",
  297. fn: function (aSymbol) {
  298. var self = this;
  299. var varname = nil;
  300. varname = smalltalk.send(aSymbol, "_asString", []);
  301. return self["@" + varname];
  302. return self;
  303. }
  304. }),
  305. smalltalk.Object);
  306. smalltalk.addMethod(
  307. "_instVarAt_put_",
  308. smalltalk.method({
  309. selector: "instVarAt:put:",
  310. fn: function (aSymbol, anObject) {
  311. var self = this;
  312. var varname = nil;
  313. varname = smalltalk.send(aSymbol, "_asString", []);
  314. self["@" + varname] = anObject;
  315. return self;
  316. }
  317. }),
  318. smalltalk.Object);
  319. smalltalk.addMethod(
  320. "_isClass",
  321. smalltalk.method({
  322. selector: "isClass",
  323. fn: function () {
  324. var self = this;
  325. return false;
  326. return self;
  327. }
  328. }),
  329. smalltalk.Object);
  330. smalltalk.addMethod(
  331. "_isKindOf_",
  332. smalltalk.method({
  333. selector: "isKindOf:",
  334. fn: function (aClass) {
  335. var self = this;
  336. 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]);}]);
  337. return self;
  338. }
  339. }),
  340. smalltalk.Object);
  341. smalltalk.addMethod(
  342. "_isMemberOf_",
  343. smalltalk.method({
  344. selector: "isMemberOf:",
  345. fn: function (aClass) {
  346. var self = this;
  347. return smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [aClass]);
  348. return self;
  349. }
  350. }),
  351. smalltalk.Object);
  352. smalltalk.addMethod(
  353. "_isMetaclass",
  354. smalltalk.method({
  355. selector: "isMetaclass",
  356. fn: function () {
  357. var self = this;
  358. return false;
  359. return self;
  360. }
  361. }),
  362. smalltalk.Object);
  363. smalltalk.addMethod(
  364. "_isNil",
  365. smalltalk.method({
  366. selector: "isNil",
  367. fn: function () {
  368. var self = this;
  369. return false;
  370. return self;
  371. }
  372. }),
  373. smalltalk.Object);
  374. smalltalk.addMethod(
  375. "_isNumber",
  376. smalltalk.method({
  377. selector: "isNumber",
  378. fn: function () {
  379. var self = this;
  380. return false;
  381. return self;
  382. }
  383. }),
  384. smalltalk.Object);
  385. smalltalk.addMethod(
  386. "_isParseFailure",
  387. smalltalk.method({
  388. selector: "isParseFailure",
  389. fn: function () {
  390. var self = this;
  391. return false;
  392. return self;
  393. }
  394. }),
  395. smalltalk.Object);
  396. smalltalk.addMethod(
  397. "_isString",
  398. smalltalk.method({
  399. selector: "isString",
  400. fn: function () {
  401. var self = this;
  402. return false;
  403. return self;
  404. }
  405. }),
  406. smalltalk.Object);
  407. smalltalk.addMethod(
  408. "_isSymbol",
  409. smalltalk.method({
  410. selector: "isSymbol",
  411. fn: function () {
  412. var self = this;
  413. return false;
  414. return self;
  415. }
  416. }),
  417. smalltalk.Object);
  418. smalltalk.addMethod(
  419. "_log_block_",
  420. smalltalk.method({
  421. selector: "log:block:",
  422. fn: function (aString, aBlock) {
  423. var self = this;
  424. var result = nil;
  425. 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", [])])]);
  426. return result;
  427. return self;
  428. }
  429. }),
  430. smalltalk.Object);
  431. smalltalk.addMethod(
  432. "_notNil",
  433. smalltalk.method({
  434. selector: "notNil",
  435. fn: function () {
  436. var self = this;
  437. return smalltalk.send(smalltalk.send(self, "_isNil", []), "_not", []);
  438. return self;
  439. }
  440. }),
  441. smalltalk.Object);
  442. smalltalk.addMethod(
  443. "_perform_",
  444. smalltalk.method({
  445. selector: "perform:",
  446. fn: function (aSymbol) {
  447. var self = this;
  448. return smalltalk.send(self, "_perform_withArguments_", [aSymbol, []]);
  449. return self;
  450. }
  451. }),
  452. smalltalk.Object);
  453. smalltalk.addMethod(
  454. "_perform_withArguments_",
  455. smalltalk.method({
  456. selector: "perform:withArguments:",
  457. fn: function (aSymbol, aCollection) {
  458. var self = this;
  459. var selector = nil;
  460. selector = smalltalk.send(aSymbol, "_asSelector", []);
  461. return smalltalk.send(self, selector, aCollection);
  462. return self;
  463. }
  464. }),
  465. smalltalk.Object);
  466. smalltalk.addMethod(
  467. "_postCopy",
  468. smalltalk.method({
  469. selector: "postCopy",
  470. fn: function () {
  471. var self = this;
  472. return self;
  473. }
  474. }),
  475. smalltalk.Object);
  476. smalltalk.addMethod(
  477. "_printNl",
  478. smalltalk.method({
  479. selector: "printNl",
  480. fn: function () {
  481. var self = this;
  482. console.log(self);
  483. return self;
  484. }
  485. }),
  486. smalltalk.Object);
  487. smalltalk.addMethod(
  488. "_printString",
  489. smalltalk.method({
  490. selector: "printString",
  491. fn: function () {
  492. var self = this;
  493. return smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]);
  494. return self;
  495. }
  496. }),
  497. smalltalk.Object);
  498. smalltalk.addMethod(
  499. "_respondsTo_",
  500. smalltalk.method({
  501. selector: "respondsTo:",
  502. fn: function (aSelector) {
  503. var self = this;
  504. return smalltalk.send(smalltalk.send(self, "_class", []), "_canUnderstand_", [aSelector]);
  505. return self;
  506. }
  507. }),
  508. smalltalk.Object);
  509. smalltalk.addMethod(
  510. "_shallowCopy",
  511. smalltalk.method({
  512. selector: "shallowCopy",
  513. fn: function () {
  514. var self = this;
  515. var copy = self.klass._new();
  516. for (var i in self) {
  517. if (/^@.+/.test(i)) {
  518. copy[i] = self[i];
  519. }
  520. }
  521. return copy;
  522. return self;
  523. }
  524. }),
  525. smalltalk.Object);
  526. smalltalk.addMethod(
  527. "_shouldNotImplement",
  528. smalltalk.method({
  529. selector: "shouldNotImplement",
  530. fn: function () {
  531. var self = this;
  532. smalltalk.send(self, "_error_", [smalltalk.send("This method should not be implemented in ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])])]);
  533. return self;
  534. }
  535. }),
  536. smalltalk.Object);
  537. smalltalk.addMethod(
  538. "_size",
  539. smalltalk.method({
  540. selector: "size",
  541. fn: function () {
  542. var self = this;
  543. smalltalk.send(self, "_error_", ["Object not indexable"]);
  544. return self;
  545. }
  546. }),
  547. smalltalk.Object);
  548. smalltalk.addMethod(
  549. "_storeOn_",
  550. smalltalk.method({
  551. selector: "storeOn:",
  552. fn: function (aStream) {
  553. var self = this;
  554. smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [])]);
  555. return self;
  556. }
  557. }),
  558. smalltalk.Object);
  559. smalltalk.addMethod(
  560. "_storeString",
  561. smalltalk.method({
  562. selector: "storeString",
  563. fn: function () {
  564. var self = this;
  565. return smalltalk.send(smalltalk.String || String, "_streamContents_", [function (s) {return smalltalk.send(self, "_storeOn_", [s]);}]);
  566. return self;
  567. }
  568. }),
  569. smalltalk.Object);
  570. smalltalk.addMethod(
  571. "_subclassResponsibility",
  572. smalltalk.method({
  573. selector: "subclassResponsibility",
  574. fn: function () {
  575. var self = this;
  576. smalltalk.send(self, "_error_", ["This method is a responsibility of a subclass"]);
  577. return self;
  578. }
  579. }),
  580. smalltalk.Object);
  581. smalltalk.addMethod(
  582. "_try_catch_",
  583. smalltalk.method({
  584. selector: "try:catch:",
  585. fn: function (aBlock, anotherBlock) {
  586. var self = this;
  587. try {
  588. result = aBlock();
  589. } catch (e) {
  590. result = anotherBlock(e);
  591. }
  592. return result;
  593. return self;
  594. }
  595. }),
  596. smalltalk.Object);
  597. smalltalk.addMethod(
  598. "_value",
  599. smalltalk.method({
  600. selector: "value",
  601. fn: function () {
  602. var self=this;
  603. return self;
  604. return self;}
  605. }),
  606. smalltalk.Object);
  607. smalltalk.addMethod(
  608. "_yourself",
  609. smalltalk.method({
  610. selector: "yourself",
  611. fn: function () {
  612. var self = this;
  613. return self;
  614. return self;
  615. }
  616. }),
  617. smalltalk.Object);
  618. smalltalk.addMethod(
  619. "_~_eq",
  620. smalltalk.method({
  621. selector: "~=",
  622. fn: function (anObject) {
  623. var self = this;
  624. return smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq", [false]);
  625. return self;
  626. }
  627. }),
  628. smalltalk.Object);
  629. smalltalk.addMethod(
  630. "_~~",
  631. smalltalk.method({
  632. selector: "~~",
  633. fn: function (anObject) {
  634. var self = this;
  635. return smalltalk.send(smalltalk.send(self, "__eq_eq", [anObject]), "__eq", [false]);
  636. return self;
  637. }
  638. }),
  639. smalltalk.Object);
  640. smalltalk.addMethod(
  641. "_initialize",
  642. smalltalk.method({
  643. selector: "initialize",
  644. fn: function () {
  645. var self = this;
  646. return self;
  647. }
  648. }),
  649. smalltalk.Object.klass);
  650. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  651. smalltalk.addMethod(
  652. "_&",
  653. smalltalk.method({
  654. selector: "&",
  655. fn: function (aBoolean) {
  656. var self = this;
  657. if (self == true) {
  658. return aBoolean;
  659. } else {
  660. return false;
  661. }
  662. return self;
  663. }
  664. }),
  665. smalltalk.Boolean);
  666. smalltalk.addMethod(
  667. "__eq",
  668. smalltalk.method({
  669. selector: "=",
  670. fn: function (aBoolean) {
  671. var self = this;
  672. var $early = {};
  673. try {
  674. ($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];}();}]);
  675. return Boolean(self == true) == aBoolean;
  676. return self;
  677. } catch (e) {
  678. if (e === $early) {
  679. return e[0];
  680. }
  681. throw e;
  682. }
  683. }
  684. }),
  685. smalltalk.Boolean);
  686. smalltalk.addMethod(
  687. "__eq_eq",
  688. smalltalk.method({
  689. selector: "==",
  690. fn: function (aBoolean) {
  691. var self = this;
  692. return smalltalk.send(self, "__eq", [aBoolean]);
  693. return self;
  694. }
  695. }),
  696. smalltalk.Boolean);
  697. smalltalk.addMethod(
  698. "_and_",
  699. smalltalk.method({
  700. selector: "and:",
  701. fn: function (aBlock) {
  702. var self = this;
  703. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [aBlock, function () {return false;}]);
  704. return self;
  705. }
  706. }),
  707. smalltalk.Boolean);
  708. smalltalk.addMethod(
  709. "_asJSON",
  710. smalltalk.method({
  711. selector: "asJSON",
  712. fn: function () {
  713. var self = this;
  714. return self;
  715. return self;
  716. }
  717. }),
  718. smalltalk.Boolean);
  719. smalltalk.addMethod(
  720. "_deepCopy",
  721. smalltalk.method({
  722. selector: "deepCopy",
  723. fn: function () {
  724. var self = this;
  725. return self;
  726. return self;
  727. }
  728. }),
  729. smalltalk.Boolean);
  730. smalltalk.addMethod(
  731. "_ifFalse_",
  732. smalltalk.method({
  733. selector: "ifFalse:",
  734. fn: function (aBlock) {
  735. var self = this;
  736. return smalltalk.send(self, "_ifTrue_ifFalse_", [function () {return nil;}, aBlock]);
  737. return self;
  738. }
  739. }),
  740. smalltalk.Boolean);
  741. smalltalk.addMethod(
  742. "_ifFalse_ifTrue_",
  743. smalltalk.method({
  744. selector: "ifFalse:ifTrue:",
  745. fn: function (aBlock, anotherBlock) {
  746. var self = this;
  747. return smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  748. return self;
  749. }
  750. }),
  751. smalltalk.Boolean);
  752. smalltalk.addMethod(
  753. "_ifTrue_",
  754. smalltalk.method({
  755. selector: "ifTrue:",
  756. fn: function (aBlock) {
  757. var self = this;
  758. return smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, function () {return nil;}]);
  759. return self;
  760. }
  761. }),
  762. smalltalk.Boolean);
  763. smalltalk.addMethod(
  764. "_ifTrue_ifFalse_",
  765. smalltalk.method({
  766. selector: "ifTrue:ifFalse:",
  767. fn: function (aBlock, anotherBlock) {
  768. var self = this;
  769. if (self == true) {
  770. return aBlock();
  771. } else {
  772. return anotherBlock();
  773. }
  774. return self;
  775. }
  776. }),
  777. smalltalk.Boolean);
  778. smalltalk.addMethod(
  779. "_not",
  780. smalltalk.method({
  781. selector: "not",
  782. fn: function () {
  783. var self = this;
  784. return smalltalk.send(self, "__eq", [false]);
  785. return self;
  786. }
  787. }),
  788. smalltalk.Boolean);
  789. smalltalk.addMethod(
  790. "_or_",
  791. smalltalk.method({
  792. selector: "or:",
  793. fn: function (aBlock) {
  794. var self = this;
  795. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [function () {return true;}, aBlock]);
  796. return self;
  797. }
  798. }),
  799. smalltalk.Boolean);
  800. smalltalk.addMethod(
  801. "_printString",
  802. smalltalk.method({
  803. selector: "printString",
  804. fn: function () {
  805. var self = this;
  806. return self.toString();
  807. return self;
  808. }
  809. }),
  810. smalltalk.Boolean);
  811. smalltalk.addMethod(
  812. "_shallowCopy",
  813. smalltalk.method({
  814. selector: "shallowCopy",
  815. fn: function () {
  816. var self = this;
  817. return self;
  818. return self;
  819. }
  820. }),
  821. smalltalk.Boolean);
  822. smalltalk.addMethod(
  823. "_|",
  824. smalltalk.method({
  825. selector: "|",
  826. fn: function (aBoolean) {
  827. var self = this;
  828. if (self == true) {
  829. return true;
  830. } else {
  831. return aBoolean;
  832. }
  833. return self;
  834. }
  835. }),
  836. smalltalk.Boolean);
  837. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  838. smalltalk.addMethod(
  839. "__plus",
  840. smalltalk.method({
  841. selector: "+",
  842. fn: function (aDate) {
  843. var self = this;
  844. return self + aDate;
  845. return self;
  846. }
  847. }),
  848. smalltalk.Date);
  849. smalltalk.addMethod(
  850. "__minus",
  851. smalltalk.method({
  852. selector: "-",
  853. fn: function (aDate) {
  854. var self = this;
  855. return self - aDate;
  856. return self;
  857. }
  858. }),
  859. smalltalk.Date);
  860. smalltalk.addMethod(
  861. "__lt",
  862. smalltalk.method({
  863. selector: "<",
  864. fn: function (aDate) {
  865. var self = this;
  866. return self < aDate;
  867. return self;
  868. }
  869. }),
  870. smalltalk.Date);
  871. smalltalk.addMethod(
  872. "__lt_eq",
  873. smalltalk.method({
  874. selector: "<=",
  875. fn: function (aDate) {
  876. var self = this;
  877. return self <= aDate;
  878. return self;
  879. }
  880. }),
  881. smalltalk.Date);
  882. smalltalk.addMethod(
  883. "__gt",
  884. smalltalk.method({
  885. selector: ">",
  886. fn: function (aDate) {
  887. var self = this;
  888. return self > aDate;
  889. return self;
  890. }
  891. }),
  892. smalltalk.Date);
  893. smalltalk.addMethod(
  894. "__gt_eq",
  895. smalltalk.method({
  896. selector: ">=",
  897. fn: function (aDate) {
  898. var self = this;
  899. return self >= aDate;
  900. return self;
  901. }
  902. }),
  903. smalltalk.Date);
  904. smalltalk.addMethod(
  905. "_asDateString",
  906. smalltalk.method({
  907. selector: "asDateString",
  908. fn: function () {
  909. var self = this;
  910. return self.toDateString();
  911. return self;
  912. }
  913. }),
  914. smalltalk.Date);
  915. smalltalk.addMethod(
  916. "_asLocaleString",
  917. smalltalk.method({
  918. selector: "asLocaleString",
  919. fn: function () {
  920. var self = this;
  921. return self.toLocaleString();
  922. return self;
  923. }
  924. }),
  925. smalltalk.Date);
  926. smalltalk.addMethod(
  927. "_asMilliseconds",
  928. smalltalk.method({
  929. selector: "asMilliseconds",
  930. fn: function () {
  931. var self = this;
  932. return smalltalk.send(self, "_time", []);
  933. return self;
  934. }
  935. }),
  936. smalltalk.Date);
  937. smalltalk.addMethod(
  938. "_asNumber",
  939. smalltalk.method({
  940. selector: "asNumber",
  941. fn: function () {
  942. var self = this;
  943. return smalltalk.send(self, "_asMilliseconds", []);
  944. return self;
  945. }
  946. }),
  947. smalltalk.Date);
  948. smalltalk.addMethod(
  949. "_asString",
  950. smalltalk.method({
  951. selector: "asString",
  952. fn: function () {
  953. var self = this;
  954. return self.toString();
  955. return self;
  956. }
  957. }),
  958. smalltalk.Date);
  959. smalltalk.addMethod(
  960. "_asTimeString",
  961. smalltalk.method({
  962. selector: "asTimeString",
  963. fn: function () {
  964. var self = this;
  965. return self.toTimeString();
  966. return self;
  967. }
  968. }),
  969. smalltalk.Date);
  970. smalltalk.addMethod(
  971. "_day",
  972. smalltalk.method({
  973. selector: "day",
  974. fn: function () {
  975. var self = this;
  976. return smalltalk.send(self, "_dayOfWeek", []);
  977. return self;
  978. }
  979. }),
  980. smalltalk.Date);
  981. smalltalk.addMethod(
  982. "_day_",
  983. smalltalk.method({
  984. selector: "day:",
  985. fn: function (aNumber) {
  986. var self = this;
  987. smalltalk.send(self, "_dayOfWeek_", [aNumber]);
  988. return self;
  989. }
  990. }),
  991. smalltalk.Date);
  992. smalltalk.addMethod(
  993. "_dayOfMonth",
  994. smalltalk.method({
  995. selector: "dayOfMonth",
  996. fn: function () {
  997. var self = this;
  998. return self.getDate();
  999. return self;
  1000. }
  1001. }),
  1002. smalltalk.Date);
  1003. smalltalk.addMethod(
  1004. "_dayOfMonth_",
  1005. smalltalk.method({
  1006. selector: "dayOfMonth:",
  1007. fn: function (aNumber) {
  1008. var self = this;
  1009. self.setDate(aNumber);
  1010. return self;
  1011. }
  1012. }),
  1013. smalltalk.Date);
  1014. smalltalk.addMethod(
  1015. "_dayOfWeek",
  1016. smalltalk.method({
  1017. selector: "dayOfWeek",
  1018. fn: function () {
  1019. var self = this;
  1020. return self.getDay() + 1;
  1021. return self;
  1022. }
  1023. }),
  1024. smalltalk.Date);
  1025. smalltalk.addMethod(
  1026. "_dayOfWeek_",
  1027. smalltalk.method({
  1028. selector: "dayOfWeek:",
  1029. fn: function (aNumber) {
  1030. var self = this;
  1031. return self.setDay(aNumber - 1);
  1032. return self;
  1033. }
  1034. }),
  1035. smalltalk.Date);
  1036. smalltalk.addMethod(
  1037. "_hours",
  1038. smalltalk.method({
  1039. selector: "hours",
  1040. fn: function () {
  1041. var self = this;
  1042. return self.getHours();
  1043. return self;
  1044. }
  1045. }),
  1046. smalltalk.Date);
  1047. smalltalk.addMethod(
  1048. "_hours_",
  1049. smalltalk.method({
  1050. selector: "hours:",
  1051. fn: function (aNumber) {
  1052. var self = this;
  1053. self.setHours(aNumber);
  1054. return self;
  1055. }
  1056. }),
  1057. smalltalk.Date);
  1058. smalltalk.addMethod(
  1059. "_milliseconds",
  1060. smalltalk.method({
  1061. selector: "milliseconds",
  1062. fn: function () {
  1063. var self = this;
  1064. return self.getMilliseconds();
  1065. return self;
  1066. }
  1067. }),
  1068. smalltalk.Date);
  1069. smalltalk.addMethod(
  1070. "_milliseconds_",
  1071. smalltalk.method({
  1072. selector: "milliseconds:",
  1073. fn: function (aNumber) {
  1074. var self = this;
  1075. self.setMilliseconds(aNumber);
  1076. return self;
  1077. }
  1078. }),
  1079. smalltalk.Date);
  1080. smalltalk.addMethod(
  1081. "_minutes",
  1082. smalltalk.method({
  1083. selector: "minutes",
  1084. fn: function () {
  1085. var self = this;
  1086. return self.getMinutes();
  1087. return self;
  1088. }
  1089. }),
  1090. smalltalk.Date);
  1091. smalltalk.addMethod(
  1092. "_minutes_",
  1093. smalltalk.method({
  1094. selector: "minutes:",
  1095. fn: function (aNumber) {
  1096. var self = this;
  1097. self.setMinutes(aNumber);
  1098. return self;
  1099. }
  1100. }),
  1101. smalltalk.Date);
  1102. smalltalk.addMethod(
  1103. "_month",
  1104. smalltalk.method({
  1105. selector: "month",
  1106. fn: function () {
  1107. var self = this;
  1108. return self.getMonth() + 1;
  1109. return self;
  1110. }
  1111. }),
  1112. smalltalk.Date);
  1113. smalltalk.addMethod(
  1114. "_month_",
  1115. smalltalk.method({
  1116. selector: "month:",
  1117. fn: function (aNumber) {
  1118. var self = this;
  1119. self.setMonth(aNumber - 1);
  1120. return self;
  1121. }
  1122. }),
  1123. smalltalk.Date);
  1124. smalltalk.addMethod(
  1125. "_printString",
  1126. smalltalk.method({
  1127. selector: "printString",
  1128. fn: function () {
  1129. var self = this;
  1130. return smalltalk.send(self, "_asString", []);
  1131. return self;
  1132. }
  1133. }),
  1134. smalltalk.Date);
  1135. smalltalk.addMethod(
  1136. "_seconds",
  1137. smalltalk.method({
  1138. selector: "seconds",
  1139. fn: function () {
  1140. var self = this;
  1141. return self.getSeconds();
  1142. return self;
  1143. }
  1144. }),
  1145. smalltalk.Date);
  1146. smalltalk.addMethod(
  1147. "_seconds_",
  1148. smalltalk.method({
  1149. selector: "seconds:",
  1150. fn: function (aNumber) {
  1151. var self = this;
  1152. self.setSeconds(aNumber);
  1153. return self;
  1154. }
  1155. }),
  1156. smalltalk.Date);
  1157. smalltalk.addMethod(
  1158. "_time",
  1159. smalltalk.method({
  1160. selector: "time",
  1161. fn: function () {
  1162. var self = this;
  1163. return self.getTime();
  1164. return self;
  1165. }
  1166. }),
  1167. smalltalk.Date);
  1168. smalltalk.addMethod(
  1169. "_time_",
  1170. smalltalk.method({
  1171. selector: "time:",
  1172. fn: function (aNumber) {
  1173. var self = this;
  1174. self.setTime(aNumber);
  1175. return self;
  1176. }
  1177. }),
  1178. smalltalk.Date);
  1179. smalltalk.addMethod(
  1180. "_year",
  1181. smalltalk.method({
  1182. selector: "year",
  1183. fn: function () {
  1184. var self = this;
  1185. return self.getFullYear();
  1186. return self;
  1187. }
  1188. }),
  1189. smalltalk.Date);
  1190. smalltalk.addMethod(
  1191. "_year_",
  1192. smalltalk.method({
  1193. selector: "year:",
  1194. fn: function (aNumber) {
  1195. var self = this;
  1196. self.setFullYear(aNumber);
  1197. return self;
  1198. }
  1199. }),
  1200. smalltalk.Date);
  1201. smalltalk.addMethod(
  1202. "_fromMilliseconds_",
  1203. smalltalk.method({
  1204. selector: "fromMilliseconds:",
  1205. fn: function (aNumber) {
  1206. var self = this;
  1207. return smalltalk.send(self, "_new_", [aNumber]);
  1208. return self;
  1209. }
  1210. }),
  1211. smalltalk.Date.klass);
  1212. smalltalk.addMethod(
  1213. "_fromSeconds_",
  1214. smalltalk.method({
  1215. selector: "fromSeconds:",
  1216. fn: function (aNumber) {
  1217. var self = this;
  1218. return smalltalk.send(self, "_fromMilliseconds_", [($receiver = aNumber).klass === smalltalk.Number ? $receiver * 1000 : smalltalk.send($receiver, "__star", [1000])]);
  1219. return self;
  1220. }
  1221. }),
  1222. smalltalk.Date.klass);
  1223. smalltalk.addMethod(
  1224. "_fromString_",
  1225. smalltalk.method({
  1226. selector: "fromString:",
  1227. fn: function (aString) {
  1228. var self = this;
  1229. return smalltalk.send(self, "_new_", [aString]);
  1230. return self;
  1231. }
  1232. }),
  1233. smalltalk.Date.klass);
  1234. smalltalk.addMethod(
  1235. "_millisecondsToRun_",
  1236. smalltalk.method({
  1237. selector: "millisecondsToRun:",
  1238. fn: function (aBlock) {
  1239. var self = this;
  1240. var t = nil;
  1241. t = smalltalk.send(smalltalk.Date || Date, "_now", []);
  1242. smalltalk.send(aBlock, "_value", []);
  1243. return ($receiver = smalltalk.send(smalltalk.Date || Date, "_now", [])).klass === smalltalk.Number ? $receiver - t : smalltalk.send($receiver, "__minus", [t]);
  1244. return self;
  1245. }
  1246. }),
  1247. smalltalk.Date.klass);
  1248. smalltalk.addMethod(
  1249. "_new_",
  1250. smalltalk.method({
  1251. selector: "new:",
  1252. fn: function (anObject) {
  1253. var self = this;
  1254. return new Date(anObject);
  1255. return self;
  1256. }
  1257. }),
  1258. smalltalk.Date.klass);
  1259. smalltalk.addMethod(
  1260. "_now",
  1261. smalltalk.method({
  1262. selector: "now",
  1263. fn: function () {
  1264. var self = this;
  1265. return smalltalk.send(self, "_today", []);
  1266. return self;
  1267. }
  1268. }),
  1269. smalltalk.Date.klass);
  1270. smalltalk.addMethod(
  1271. "_today",
  1272. smalltalk.method({
  1273. selector: "today",
  1274. fn: function () {
  1275. var self = this;
  1276. return smalltalk.send(self, "_new", []);
  1277. return self;
  1278. }
  1279. }),
  1280. smalltalk.Date.klass);
  1281. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  1282. smalltalk.addMethod(
  1283. "_at_",
  1284. smalltalk.method({
  1285. selector: "at:",
  1286. fn: function (aSymbol) {
  1287. var self = this;
  1288. var attr = nil;
  1289. attr = smalltalk.send(aSymbol, "_asString", []);
  1290. return self['@jsObject'][attr];
  1291. return self;
  1292. }
  1293. }),
  1294. smalltalk.JSObjectProxy);
  1295. smalltalk.addMethod(
  1296. "_at_put_",
  1297. smalltalk.method({
  1298. selector: "at:put:",
  1299. fn: function (aSymbol, anObject) {
  1300. var self = this;
  1301. var attr = nil;
  1302. attr = smalltalk.send(aSymbol, "_asString", []);
  1303. self['@jsObject'][attr] = anObject;
  1304. return self;
  1305. }
  1306. }),
  1307. smalltalk.JSObjectProxy);
  1308. smalltalk.addMethod(
  1309. "_doesNotUnderstand_",
  1310. smalltalk.method({
  1311. selector: "doesNotUnderstand:",
  1312. fn: function (aMessage) {
  1313. var self = this;
  1314. var obj = nil;
  1315. var selector = nil;
  1316. var jsSelector = nil;
  1317. var arguments = nil;
  1318. obj = smalltalk.send(self, "_jsObject", []);
  1319. selector = smalltalk.send(aMessage, "_selector", []);
  1320. jsSelector = smalltalk.send(selector, "_asJavaScriptSelector", []);
  1321. arguments = smalltalk.send(aMessage, "_arguments", []);
  1322. if (obj[jsSelector] != undefined) {
  1323. return smalltalk.send(obj, jsSelector, arguments);
  1324. }
  1325. smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.JSObjectProxy.superclass || nil);
  1326. return self;
  1327. }
  1328. }),
  1329. smalltalk.JSObjectProxy);
  1330. smalltalk.addMethod(
  1331. "_inspectOn_",
  1332. smalltalk.method({
  1333. selector: "inspectOn:",
  1334. fn: function (anInspector) {
  1335. var self = this;
  1336. var variables = nil;
  1337. variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  1338. smalltalk.send(variables, "_at_put_", ["#self", smalltalk.send(self, "_jsObject", [])]);
  1339. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  1340. for (var i in self['@jsObject']) {
  1341. variables._at_put_(i, self['@jsObject'][i]);
  1342. }
  1343. smalltalk.send(anInspector, "_setVariables_", [variables]);
  1344. return self;
  1345. }
  1346. }),
  1347. smalltalk.JSObjectProxy);
  1348. smalltalk.addMethod(
  1349. "_jsObject",
  1350. smalltalk.method({
  1351. selector: "jsObject",
  1352. fn: function () {
  1353. var self = this;
  1354. return self['@jsObject'];
  1355. return self;
  1356. }
  1357. }),
  1358. smalltalk.JSObjectProxy);
  1359. smalltalk.addMethod(
  1360. "_jsObject_",
  1361. smalltalk.method({
  1362. selector: "jsObject:",
  1363. fn: function (aJSObject) {
  1364. var self = this;
  1365. self['@jsObject'] = aJSObject;
  1366. return self;
  1367. }
  1368. }),
  1369. smalltalk.JSObjectProxy);
  1370. smalltalk.addMethod(
  1371. "_printString",
  1372. smalltalk.method({
  1373. selector: "printString",
  1374. fn: function () {
  1375. var self = this;
  1376. return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_toString", []);
  1377. return self;
  1378. }
  1379. }),
  1380. smalltalk.JSObjectProxy);
  1381. smalltalk.addMethod(
  1382. "_on_",
  1383. smalltalk.method({
  1384. selector: "on:",
  1385. fn: function (aJSObject) {
  1386. var self = this;
  1387. return function ($rec) {smalltalk.send($rec, "_jsObject_", [aJSObject]);return smalltalk.send($rec, "_yourself", []);}(smalltalk.send(self, "_new", []));
  1388. return self;
  1389. }
  1390. }),
  1391. smalltalk.JSObjectProxy.klass);
  1392. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  1393. smalltalk.addMethod(
  1394. "_&",
  1395. smalltalk.method({
  1396. selector: "&",
  1397. fn: function (aNumber) {
  1398. var self = this;
  1399. return self & aNumber;
  1400. return self;
  1401. }
  1402. }),
  1403. smalltalk.Number);
  1404. smalltalk.addMethod(
  1405. "__star",
  1406. smalltalk.method({
  1407. selector: "*",
  1408. fn: function (aNumber) {
  1409. var self = this;
  1410. return self * aNumber;
  1411. return self;
  1412. }
  1413. }),
  1414. smalltalk.Number);
  1415. smalltalk.addMethod(
  1416. "__plus",
  1417. smalltalk.method({
  1418. selector: "+",
  1419. fn: function (aNumber) {
  1420. var self = this;
  1421. return self + aNumber;
  1422. return self;
  1423. }
  1424. }),
  1425. smalltalk.Number);
  1426. smalltalk.addMethod(
  1427. "__minus",
  1428. smalltalk.method({
  1429. selector: "-",
  1430. fn: function (aNumber) {
  1431. var self = this;
  1432. return self - aNumber;
  1433. return self;
  1434. }
  1435. }),
  1436. smalltalk.Number);
  1437. smalltalk.addMethod(
  1438. "__slash",
  1439. smalltalk.method({
  1440. selector: "/",
  1441. fn: function (aNumber) {
  1442. var self = this;
  1443. return self / aNumber;
  1444. return self;
  1445. }
  1446. }),
  1447. smalltalk.Number);
  1448. smalltalk.addMethod(
  1449. "__lt",
  1450. smalltalk.method({
  1451. selector: "<",
  1452. fn: function (aNumber) {
  1453. var self = this;
  1454. return self < aNumber;
  1455. return self;
  1456. }
  1457. }),
  1458. smalltalk.Number);
  1459. smalltalk.addMethod(
  1460. "__lt_eq",
  1461. smalltalk.method({
  1462. selector: "<=",
  1463. fn: function (aNumber) {
  1464. var self = this;
  1465. return self <= aNumber;
  1466. return self;
  1467. }
  1468. }),
  1469. smalltalk.Number);
  1470. smalltalk.addMethod(
  1471. "__eq",
  1472. smalltalk.method({
  1473. selector: "=",
  1474. fn: function (aNumber) {
  1475. var self = this;
  1476. var $early = {};
  1477. try {
  1478. ($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];}();}]);
  1479. return Number(self) == aNumber;
  1480. return self;
  1481. } catch (e) {
  1482. if (e === $early) {
  1483. return e[0];
  1484. }
  1485. throw e;
  1486. }
  1487. }
  1488. }),
  1489. smalltalk.Number);
  1490. smalltalk.addMethod(
  1491. "__gt",
  1492. smalltalk.method({
  1493. selector: ">",
  1494. fn: function (aNumber) {
  1495. var self = this;
  1496. return self > aNumber;
  1497. return self;
  1498. }
  1499. }),
  1500. smalltalk.Number);
  1501. smalltalk.addMethod(
  1502. "__gt_eq",
  1503. smalltalk.method({
  1504. selector: ">=",
  1505. fn: function (aNumber) {
  1506. var self = this;
  1507. return self >= aNumber;
  1508. return self;
  1509. }
  1510. }),
  1511. smalltalk.Number);
  1512. smalltalk.addMethod(
  1513. "__at",
  1514. smalltalk.method({
  1515. selector: "@",
  1516. fn: function (aNumber) {
  1517. var self = this;
  1518. return smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, aNumber]);
  1519. return self;
  1520. }
  1521. }),
  1522. smalltalk.Number);
  1523. smalltalk.addMethod(
  1524. "_\x5c\x5c",
  1525. smalltalk.method({
  1526. selector: "\x5c\x5c",
  1527. fn: function (aNumber) {
  1528. var self = this;
  1529. return self % aNumber;
  1530. return self;
  1531. }
  1532. }),
  1533. smalltalk.Number);
  1534. smalltalk.addMethod(
  1535. "_abs",
  1536. smalltalk.method({
  1537. selector: "abs",
  1538. fn: function () {
  1539. var self=this;
  1540. return Math.abs(self);;
  1541. return self;}
  1542. }),
  1543. smalltalk.Number);
  1544. smalltalk.addMethod(
  1545. "_asJSON",
  1546. smalltalk.method({
  1547. selector: "asJSON",
  1548. fn: function () {
  1549. var self = this;
  1550. return self;
  1551. return self;
  1552. }
  1553. }),
  1554. smalltalk.Number);
  1555. smalltalk.addMethod(
  1556. "_asJavascript",
  1557. smalltalk.method({
  1558. selector: "asJavascript",
  1559. fn: function () {
  1560. var self = this;
  1561. return smalltalk.send(smalltalk.send("(", "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [")"]);
  1562. return self;
  1563. }
  1564. }),
  1565. smalltalk.Number);
  1566. smalltalk.addMethod(
  1567. "_asPoint",
  1568. smalltalk.method({
  1569. selector: "asPoint",
  1570. fn: function () {
  1571. var self = this;
  1572. return smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, self]);
  1573. return self;
  1574. }
  1575. }),
  1576. smalltalk.Number);
  1577. smalltalk.addMethod(
  1578. "_asString",
  1579. smalltalk.method({
  1580. selector: "asString",
  1581. fn: function () {
  1582. var self = this;
  1583. return smalltalk.send(self, "_printString", []);
  1584. return self;
  1585. }
  1586. }),
  1587. smalltalk.Number);
  1588. smalltalk.addMethod(
  1589. "_atRandom",
  1590. smalltalk.method({
  1591. selector: "atRandom",
  1592. fn: function () {
  1593. var self = this;
  1594. 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]);
  1595. return self;
  1596. }
  1597. }),
  1598. smalltalk.Number);
  1599. smalltalk.addMethod(
  1600. "_clearInterval",
  1601. smalltalk.method({
  1602. selector: "clearInterval",
  1603. fn: function () {
  1604. var self = this;
  1605. clearInterval(Number(self));
  1606. return self;
  1607. }
  1608. }),
  1609. smalltalk.Number);
  1610. smalltalk.addMethod(
  1611. "_clearTimeout",
  1612. smalltalk.method({
  1613. selector: "clearTimeout",
  1614. fn: function () {
  1615. var self = this;
  1616. clearTimeout(Number(self));
  1617. return self;
  1618. }
  1619. }),
  1620. smalltalk.Number);
  1621. smalltalk.addMethod(
  1622. "_copy",
  1623. smalltalk.method({
  1624. selector: "copy",
  1625. fn: function () {
  1626. var self = this;
  1627. return self;
  1628. return self;
  1629. }
  1630. }),
  1631. smalltalk.Number);
  1632. smalltalk.addMethod(
  1633. "_deepCopy",
  1634. smalltalk.method({
  1635. selector: "deepCopy",
  1636. fn: function () {
  1637. var self = this;
  1638. return smalltalk.send(self, "_copy", []);
  1639. return self;
  1640. }
  1641. }),
  1642. smalltalk.Number);
  1643. smalltalk.addMethod(
  1644. "_even",
  1645. smalltalk.method({
  1646. selector: "even",
  1647. fn: function () {
  1648. var self = this;
  1649. return smalltalk.send(0, "__eq", [smalltalk.send(self, "_\\\\", [2])]);
  1650. return self;
  1651. }
  1652. }),
  1653. smalltalk.Number);
  1654. smalltalk.addMethod(
  1655. "_identityHash",
  1656. smalltalk.method({
  1657. selector: "identityHash",
  1658. fn: function () {
  1659. var self = this;
  1660. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", ["n"]);
  1661. return self;
  1662. }
  1663. }),
  1664. smalltalk.Number);
  1665. smalltalk.addMethod(
  1666. "_isNumber",
  1667. smalltalk.method({
  1668. selector: "isNumber",
  1669. fn: function () {
  1670. var self = this;
  1671. return true;
  1672. return self;
  1673. }
  1674. }),
  1675. smalltalk.Number);
  1676. smalltalk.addMethod(
  1677. "_isZero",
  1678. smalltalk.method({
  1679. selector: "isZero",
  1680. fn: function () {
  1681. var self = this;
  1682. return smalltalk.send(self, "__eq", [0]);
  1683. return self;
  1684. }
  1685. }),
  1686. smalltalk.Number);
  1687. smalltalk.addMethod(
  1688. "_max_",
  1689. smalltalk.method({
  1690. selector: "max:",
  1691. fn: function (aNumber) {
  1692. var self = this;
  1693. return Math.max(self, aNumber);
  1694. return self;
  1695. }
  1696. }),
  1697. smalltalk.Number);
  1698. smalltalk.addMethod(
  1699. "_min_",
  1700. smalltalk.method({
  1701. selector: "min:",
  1702. fn: function (aNumber) {
  1703. var self = this;
  1704. return Math.min(self, aNumber);
  1705. return self;
  1706. }
  1707. }),
  1708. smalltalk.Number);
  1709. smalltalk.addMethod(
  1710. "_negated",
  1711. smalltalk.method({
  1712. selector: "negated",
  1713. fn: function () {
  1714. var self = this;
  1715. return 0 - self;
  1716. return self;
  1717. }
  1718. }),
  1719. smalltalk.Number);
  1720. smalltalk.addMethod(
  1721. "_negative",
  1722. smalltalk.method({
  1723. selector: "negative",
  1724. fn: function () {
  1725. var self = this;
  1726. return self < 0;
  1727. return self;
  1728. }
  1729. }),
  1730. smalltalk.Number);
  1731. smalltalk.addMethod(
  1732. "_odd",
  1733. smalltalk.method({
  1734. selector: "odd",
  1735. fn: function () {
  1736. var self = this;
  1737. return smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  1738. return self;
  1739. }
  1740. }),
  1741. smalltalk.Number);
  1742. smalltalk.addMethod(
  1743. "_positive",
  1744. smalltalk.method({
  1745. selector: "positive",
  1746. fn: function () {
  1747. var self = this;
  1748. return self >= 0;
  1749. return self;
  1750. }
  1751. }),
  1752. smalltalk.Number);
  1753. smalltalk.addMethod(
  1754. "_printShowingDecimalPlaces_",
  1755. smalltalk.method({
  1756. selector: "printShowingDecimalPlaces:",
  1757. fn: function (placesDesired) {
  1758. var self = this;
  1759. return self.toFixed(placesDesired);
  1760. return self;
  1761. }
  1762. }),
  1763. smalltalk.Number);
  1764. smalltalk.addMethod(
  1765. "_printString",
  1766. smalltalk.method({
  1767. selector: "printString",
  1768. fn: function () {
  1769. var self = this;
  1770. return String(self);
  1771. return self;
  1772. }
  1773. }),
  1774. smalltalk.Number);
  1775. smalltalk.addMethod(
  1776. "_rounded",
  1777. smalltalk.method({
  1778. selector: "rounded",
  1779. fn: function () {
  1780. var self = this;
  1781. return Math.round(self);
  1782. return self;
  1783. }
  1784. }),
  1785. smalltalk.Number);
  1786. smalltalk.addMethod(
  1787. "_sqrt",
  1788. smalltalk.method({
  1789. selector: "sqrt",
  1790. fn: function () {
  1791. var self = this;
  1792. return Math.sqrt(self);
  1793. return self;
  1794. }
  1795. }),
  1796. smalltalk.Number);
  1797. smalltalk.addMethod(
  1798. "_squared",
  1799. smalltalk.method({
  1800. selector: "squared",
  1801. fn: function () {
  1802. var self = this;
  1803. return self * self;
  1804. return self;
  1805. }
  1806. }),
  1807. smalltalk.Number);
  1808. smalltalk.addMethod(
  1809. "_timesRepeat_",
  1810. smalltalk.method({
  1811. selector: "timesRepeat:",
  1812. fn: function (aBlock) {
  1813. var self = this;
  1814. var integer = nil;
  1815. var count = nil;
  1816. integer = smalltalk.send(self, "_truncated", []);
  1817. count = 1;
  1818. (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]);}());}}());
  1819. return self;
  1820. }
  1821. }),
  1822. smalltalk.Number);
  1823. smalltalk.addMethod(
  1824. "_to_",
  1825. smalltalk.method({
  1826. selector: "to:",
  1827. fn: function (aNumber) {
  1828. var self = this;
  1829. var array = nil;
  1830. var first = nil;
  1831. var last = nil;
  1832. var count = nil;
  1833. first = smalltalk.send(self, "_truncated", []);
  1834. last = ($receiver = smalltalk.send(aNumber, "_truncated", [])).klass === smalltalk.Number ? $receiver + 1 : smalltalk.send($receiver, "__plus", [1]);
  1835. count = 1;
  1836. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  1837. 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]);}]);
  1838. return array;
  1839. return self;
  1840. }
  1841. }),
  1842. smalltalk.Number);
  1843. smalltalk.addMethod(
  1844. "_to_by_",
  1845. smalltalk.method({
  1846. selector: "to:by:",
  1847. fn: function (stop, step) {
  1848. var self = this;
  1849. var array = nil;
  1850. var value = nil;
  1851. var pos = nil;
  1852. value = self;
  1853. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  1854. pos = 1;
  1855. ($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"]);}]);
  1856. ($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]);}());}}();}]);
  1857. return array;
  1858. return self;
  1859. }
  1860. }),
  1861. smalltalk.Number);
  1862. smalltalk.addMethod(
  1863. "_to_by_do_",
  1864. smalltalk.method({
  1865. selector: "to:by:do:",
  1866. fn: function (stop, step, aBlock) {
  1867. var self = this;
  1868. var value = nil;
  1869. value = self;
  1870. ($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"]);}]);
  1871. ($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]);}());}}();}]);
  1872. return self;
  1873. }
  1874. }),
  1875. smalltalk.Number);
  1876. smalltalk.addMethod(
  1877. "_to_do_",
  1878. smalltalk.method({
  1879. selector: "to:do:",
  1880. fn: function (stop, aBlock) {
  1881. var self = this;
  1882. var nextValue = nil;
  1883. nextValue = self;
  1884. (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]);}());}}());
  1885. return self;
  1886. }
  1887. }),
  1888. smalltalk.Number);
  1889. smalltalk.addMethod(
  1890. "_truncated",
  1891. smalltalk.method({
  1892. selector: "truncated",
  1893. fn: function () {
  1894. var self = this;
  1895. var result = nil;
  1896. ($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;}]);
  1897. return result;
  1898. return self;
  1899. }
  1900. }),
  1901. smalltalk.Number);
  1902. smalltalk.addMethod(
  1903. "_|",
  1904. smalltalk.method({
  1905. selector: "|",
  1906. fn: function (aNumber) {
  1907. var self = this;
  1908. return self | aNumber;
  1909. return self;
  1910. }
  1911. }),
  1912. smalltalk.Number);
  1913. smalltalk.addMethod(
  1914. "_pi",
  1915. smalltalk.method({
  1916. selector: "pi",
  1917. fn: function () {
  1918. var self = this;
  1919. return Math.PI;
  1920. return self;
  1921. }
  1922. }),
  1923. smalltalk.Number.klass);
  1924. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  1925. smalltalk.addMethod(
  1926. "_classes",
  1927. smalltalk.method({
  1928. selector: "classes",
  1929. fn: function () {
  1930. var self = this;
  1931. 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]);}]);
  1932. return self;
  1933. }
  1934. }),
  1935. smalltalk.Package);
  1936. smalltalk.addMethod(
  1937. "_commitPathJs",
  1938. smalltalk.method({
  1939. selector: "commitPathJs",
  1940. fn: function () {
  1941. var self = this;
  1942. return ($receiver = self['@commitPathJs']) == nil ||
  1943. $receiver == undefined ? function () {return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);}() : $receiver;
  1944. return self;
  1945. }
  1946. }),
  1947. smalltalk.Package);
  1948. smalltalk.addMethod(
  1949. "_commitPathJs_",
  1950. smalltalk.method({
  1951. selector: "commitPathJs:",
  1952. fn: function (aString) {
  1953. var self = this;
  1954. self['@commitPathJs'] = aString;
  1955. return self;
  1956. }
  1957. }),
  1958. smalltalk.Package);
  1959. smalltalk.addMethod(
  1960. "_commitPathSt",
  1961. smalltalk.method({
  1962. selector: "commitPathSt",
  1963. fn: function () {
  1964. var self = this;
  1965. return ($receiver = self['@commitPathSt']) == nil ||
  1966. $receiver == undefined ? function () {return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);}() : $receiver;
  1967. return self;
  1968. }
  1969. }),
  1970. smalltalk.Package);
  1971. smalltalk.addMethod(
  1972. "_commitPathSt_",
  1973. smalltalk.method({
  1974. selector: "commitPathSt:",
  1975. fn: function (aString) {
  1976. var self = this;
  1977. self['@commitPathSt'] = aString;
  1978. return self;
  1979. }
  1980. }),
  1981. smalltalk.Package);
  1982. smalltalk.addMethod(
  1983. "_dependencies",
  1984. smalltalk.method({
  1985. selector: "dependencies",
  1986. fn: function () {
  1987. var self = this;
  1988. return smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", function () {return [];}]);
  1989. return self;
  1990. }
  1991. }),
  1992. smalltalk.Package);
  1993. smalltalk.addMethod(
  1994. "_dependencies_",
  1995. smalltalk.method({
  1996. selector: "dependencies:",
  1997. fn: function (anArray) {
  1998. var self = this;
  1999. return smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  2000. return self;
  2001. }
  2002. }),
  2003. smalltalk.Package);
  2004. smalltalk.addMethod(
  2005. "_jsProperties",
  2006. smalltalk.method({
  2007. selector: "jsProperties",
  2008. fn: function () {
  2009. var self = this;
  2010. return self.properties;
  2011. return self;
  2012. }
  2013. }),
  2014. smalltalk.Package);
  2015. smalltalk.addMethod(
  2016. "_jsProperties_",
  2017. smalltalk.method({
  2018. selector: "jsProperties:",
  2019. fn: function (aJSObject) {
  2020. var self = this;
  2021. return self.properties = aJSObject;
  2022. return self;
  2023. }
  2024. }),
  2025. smalltalk.Package);
  2026. smalltalk.addMethod(
  2027. "_name",
  2028. smalltalk.method({
  2029. selector: "name",
  2030. fn: function () {
  2031. var self = this;
  2032. return self.pkgName;
  2033. return self;
  2034. }
  2035. }),
  2036. smalltalk.Package);
  2037. smalltalk.addMethod(
  2038. "_name_",
  2039. smalltalk.method({
  2040. selector: "name:",
  2041. fn: function (aString) {
  2042. var self = this;
  2043. self.pkgName = aString;
  2044. return self;
  2045. }
  2046. }),
  2047. smalltalk.Package);
  2048. smalltalk.addMethod(
  2049. "_printString",
  2050. smalltalk.method({
  2051. selector: "printString",
  2052. fn: function () {
  2053. var self = this;
  2054. return smalltalk.send(self, "_name", []);
  2055. return self;
  2056. }
  2057. }),
  2058. smalltalk.Package);
  2059. smalltalk.addMethod(
  2060. "_properties",
  2061. smalltalk.method({
  2062. selector: "properties",
  2063. fn: function () {
  2064. var self = this;
  2065. return smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  2066. return self;
  2067. }
  2068. }),
  2069. smalltalk.Package);
  2070. smalltalk.addMethod(
  2071. "_properties_",
  2072. smalltalk.method({
  2073. selector: "properties:",
  2074. fn: function (aDict) {
  2075. var self = this;
  2076. var object = nil;
  2077. object = {};
  2078. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  2079. return self.properties = object;
  2080. return self;
  2081. }
  2082. }),
  2083. smalltalk.Package);
  2084. smalltalk.addMethod(
  2085. "_propertiesAsJSON",
  2086. smalltalk.method({
  2087. selector: "propertiesAsJSON",
  2088. fn: function () {
  2089. var self = this;
  2090. return JSON.stringify(self.properties);
  2091. return self;
  2092. }
  2093. }),
  2094. smalltalk.Package);
  2095. smalltalk.addMethod(
  2096. "_propertyAt_",
  2097. smalltalk.method({
  2098. selector: "propertyAt:",
  2099. fn: function (key) {
  2100. var self = this;
  2101. return self.properties[key];
  2102. return self;
  2103. }
  2104. }),
  2105. smalltalk.Package);
  2106. smalltalk.addMethod(
  2107. "_propertyAt_ifAbsent_",
  2108. smalltalk.method({
  2109. selector: "propertyAt:ifAbsent:",
  2110. fn: function (key, block) {
  2111. var self = this;
  2112. return ($receiver = smalltalk.send(self, "_propertyAt_", [key])) == nil ||
  2113. $receiver == undefined ? function () {return smalltalk.send(block, "_value", []);}() : $receiver;
  2114. return self;
  2115. }
  2116. }),
  2117. smalltalk.Package);
  2118. smalltalk.addMethod(
  2119. "_propertyAt_put_",
  2120. smalltalk.method({
  2121. selector: "propertyAt:put:",
  2122. fn: function (key, value) {
  2123. var self = this;
  2124. return self.properties[key] = value;
  2125. return self;
  2126. }
  2127. }),
  2128. smalltalk.Package);
  2129. smalltalk.addMethod(
  2130. "_sortedClasses",
  2131. smalltalk.method({
  2132. selector: "sortedClasses",
  2133. fn: function () {
  2134. var self = this;
  2135. return smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  2136. return self;
  2137. }
  2138. }),
  2139. smalltalk.Package);
  2140. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  2141. smalltalk.addMethod(
  2142. "_commitToLocalStorage_",
  2143. smalltalk.method({
  2144. selector: "commitToLocalStorage:",
  2145. fn: function (aPackageName) {
  2146. var self = this;
  2147. var key = nil;
  2148. var sourceCode = nil;
  2149. key = smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]);
  2150. sourceCode = smalltalk.send(smalltalk.send(smalltalk.Exporter || Exporter, "_new", []), "_exportPackage_", [aPackageName]);
  2151. localStorage[key] = escape(sourceCode);
  2152. return self;
  2153. }
  2154. }),
  2155. smalltalk.Package.klass);
  2156. smalltalk.addMethod(
  2157. "_defaultCommitPathJs",
  2158. smalltalk.method({
  2159. selector: "defaultCommitPathJs",
  2160. fn: function () {
  2161. var self = this;
  2162. return ($receiver = self['@defaultCommitPathJs']) == nil ||
  2163. $receiver == undefined ? function () {return self['@defaultCommitPathJs'] = "js";}() : $receiver;
  2164. return self;
  2165. }
  2166. }),
  2167. smalltalk.Package.klass);
  2168. smalltalk.addMethod(
  2169. "_defaultCommitPathJs_",
  2170. smalltalk.method({
  2171. selector: "defaultCommitPathJs:",
  2172. fn: function (aString) {
  2173. var self = this;
  2174. self['@defaultCommitPathJs'] = aString;
  2175. return self;
  2176. }
  2177. }),
  2178. smalltalk.Package.klass);
  2179. smalltalk.addMethod(
  2180. "_defaultCommitPathSt",
  2181. smalltalk.method({
  2182. selector: "defaultCommitPathSt",
  2183. fn: function () {
  2184. var self = this;
  2185. return ($receiver = self['@defaultCommitPathSt']) == nil ||
  2186. $receiver == undefined ? function () {return self['@defaultCommitPathSt'] = "st";}() : $receiver;
  2187. return self;
  2188. }
  2189. }),
  2190. smalltalk.Package.klass);
  2191. smalltalk.addMethod(
  2192. "_defaultCommitPathSt_",
  2193. smalltalk.method({
  2194. selector: "defaultCommitPathSt:",
  2195. fn: function (aString) {
  2196. var self = this;
  2197. self['@defaultCommitPathSt'] = aString;
  2198. return self;
  2199. }
  2200. }),
  2201. smalltalk.Package.klass);
  2202. smalltalk.addMethod(
  2203. "_fetch_",
  2204. smalltalk.method({
  2205. selector: "fetch:",
  2206. fn: function (aPackageName) {
  2207. var self = this;
  2208. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  2209. return self;
  2210. }
  2211. }),
  2212. smalltalk.Package.klass);
  2213. smalltalk.addMethod(
  2214. "_fetch_prefix_",
  2215. smalltalk.method({
  2216. selector: "fetch:prefix:",
  2217. fn: function (aPackageName, aPrefix) {
  2218. var self = this;
  2219. 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]);}]);
  2220. return self;
  2221. }
  2222. }),
  2223. smalltalk.Package.klass);
  2224. smalltalk.addMethod(
  2225. "_init_",
  2226. smalltalk.method({
  2227. selector: "init:",
  2228. fn: function (aPackageName) {
  2229. var self = this;
  2230. (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;}])));
  2231. return self;
  2232. }
  2233. }),
  2234. smalltalk.Package.klass);
  2235. smalltalk.addMethod(
  2236. "_named_",
  2237. smalltalk.method({
  2238. selector: "named:",
  2239. fn: function (aPackageName) {
  2240. var self = this;
  2241. return smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_", [aPackageName]);
  2242. return self;
  2243. }
  2244. }),
  2245. smalltalk.Package.klass);
  2246. smalltalk.addMethod(
  2247. "_named_ifAbsent_",
  2248. smalltalk.method({
  2249. selector: "named:ifAbsent:",
  2250. fn: function (aPackageName, aBlock) {
  2251. var self = this;
  2252. return smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  2253. return self;
  2254. }
  2255. }),
  2256. smalltalk.Package.klass);
  2257. smalltalk.addMethod(
  2258. "_resetCommitPaths",
  2259. smalltalk.method({
  2260. selector: "resetCommitPaths",
  2261. fn: function () {
  2262. var self = this;
  2263. self['@defaultCommitPathJs'] = nil;
  2264. self['@defaultCommitPathSt'] = nil;
  2265. return self;
  2266. }
  2267. }),
  2268. smalltalk.Package.klass);
  2269. smalltalk.addMethod(
  2270. "_sortedClasses_",
  2271. smalltalk.method({
  2272. selector: "sortedClasses:",
  2273. fn: function (classes) {
  2274. var self = this;
  2275. var children = nil;
  2276. var others = nil;
  2277. var nodes = nil;
  2278. var expandedClasses = nil;
  2279. children = [];
  2280. others = [];
  2281. 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]);}]);}]);
  2282. nodes = smalltalk.send(children, "_collect_", [function (each) {return smalltalk.send(smalltalk.ClassSorterNode || ClassSorterNode, "_on_classes_level_", [each, others, 0]);}]);
  2283. 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", [])]);}]);
  2284. expandedClasses = smalltalk.send(smalltalk.Array || Array, "_new", []);
  2285. smalltalk.send(nodes, "_do_", [function (aNode) {return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);}]);
  2286. return expandedClasses;
  2287. return self;
  2288. }
  2289. }),
  2290. smalltalk.Package.klass);
  2291. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  2292. smalltalk.addMethod(
  2293. "__star",
  2294. smalltalk.method({
  2295. selector: "*",
  2296. fn: function (aPoint) {
  2297. var self = this;
  2298. 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", [])])]);
  2299. return self;
  2300. }
  2301. }),
  2302. smalltalk.Point);
  2303. smalltalk.addMethod(
  2304. "__plus",
  2305. smalltalk.method({
  2306. selector: "+",
  2307. fn: function (aPoint) {
  2308. var self = this;
  2309. 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", [])])]);
  2310. return self;
  2311. }
  2312. }),
  2313. smalltalk.Point);
  2314. smalltalk.addMethod(
  2315. "__minus",
  2316. smalltalk.method({
  2317. selector: "-",
  2318. fn: function (aPoint) {
  2319. var self = this;
  2320. 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", [])])]);
  2321. return self;
  2322. }
  2323. }),
  2324. smalltalk.Point);
  2325. smalltalk.addMethod(
  2326. "__slash",
  2327. smalltalk.method({
  2328. selector: "/",
  2329. fn: function (aPoint) {
  2330. var self = this;
  2331. 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", [])])]);
  2332. return self;
  2333. }
  2334. }),
  2335. smalltalk.Point);
  2336. smalltalk.addMethod(
  2337. "__eq",
  2338. smalltalk.method({
  2339. selector: "=",
  2340. fn: function (aPoint) {
  2341. var self = this;
  2342. 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", [])])]);}]);
  2343. return self;
  2344. }
  2345. }),
  2346. smalltalk.Point);
  2347. smalltalk.addMethod(
  2348. "_asPoint",
  2349. smalltalk.method({
  2350. selector: "asPoint",
  2351. fn: function () {
  2352. var self = this;
  2353. return self;
  2354. return self;
  2355. }
  2356. }),
  2357. smalltalk.Point);
  2358. smalltalk.addMethod(
  2359. "_printString",
  2360. smalltalk.method({
  2361. selector: "printString",
  2362. fn: function () {
  2363. var self = this;
  2364. 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", [])]);}]);
  2365. return self;
  2366. }
  2367. }),
  2368. smalltalk.Point);
  2369. smalltalk.addMethod(
  2370. "_translateBy_",
  2371. smalltalk.method({
  2372. selector: "translateBy:",
  2373. fn: function (delta) {
  2374. var self = this;
  2375. 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']])]);
  2376. return self;
  2377. }
  2378. }),
  2379. smalltalk.Point);
  2380. smalltalk.addMethod(
  2381. "_x",
  2382. smalltalk.method({
  2383. selector: "x",
  2384. fn: function () {
  2385. var self = this;
  2386. return self['@x'];
  2387. return self;
  2388. }
  2389. }),
  2390. smalltalk.Point);
  2391. smalltalk.addMethod(
  2392. "_x_",
  2393. smalltalk.method({
  2394. selector: "x:",
  2395. fn: function (aNumber) {
  2396. var self = this;
  2397. self['@x'] = aNumber;
  2398. return self;
  2399. }
  2400. }),
  2401. smalltalk.Point);
  2402. smalltalk.addMethod(
  2403. "_y",
  2404. smalltalk.method({
  2405. selector: "y",
  2406. fn: function () {
  2407. var self = this;
  2408. return self['@y'];
  2409. return self;
  2410. }
  2411. }),
  2412. smalltalk.Point);
  2413. smalltalk.addMethod(
  2414. "_y_",
  2415. smalltalk.method({
  2416. selector: "y:",
  2417. fn: function (aNumber) {
  2418. var self = this;
  2419. self['@y'] = aNumber;
  2420. return self;
  2421. }
  2422. }),
  2423. smalltalk.Point);
  2424. smalltalk.addMethod(
  2425. "_x_y_",
  2426. smalltalk.method({
  2427. selector: "x:y:",
  2428. fn: function (aNumber, anotherNumber) {
  2429. var self = this;
  2430. return function ($rec) {smalltalk.send($rec, "_x_", [aNumber]);smalltalk.send($rec, "_y_", [anotherNumber]);return smalltalk.send($rec, "_yourself", []);}(smalltalk.send(self, "_new", []));
  2431. return self;
  2432. }
  2433. }),
  2434. smalltalk.Point.klass);
  2435. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  2436. smalltalk.addMethod(
  2437. "_next",
  2438. smalltalk.method({
  2439. selector: "next",
  2440. fn: function () {
  2441. var self = this;
  2442. return Math.random();
  2443. return self;
  2444. }
  2445. }),
  2446. smalltalk.Random);
  2447. smalltalk.addMethod(
  2448. "_next_",
  2449. smalltalk.method({
  2450. selector: "next:",
  2451. fn: function (anInteger) {
  2452. var self = this;
  2453. return smalltalk.send(smalltalk.send(1, "_to_", [anInteger]), "_collect_", [function (each) {return smalltalk.send(self, "_next", []);}]);
  2454. return self;
  2455. }
  2456. }),
  2457. smalltalk.Random);
  2458. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  2459. smalltalk.addMethod(
  2460. "_at_",
  2461. smalltalk.method({
  2462. selector: "at:",
  2463. fn: function (aString) {
  2464. var self = this;
  2465. return self[aString];
  2466. return self;
  2467. }
  2468. }),
  2469. smalltalk.Smalltalk);
  2470. smalltalk.addMethod(
  2471. "_basicParse_",
  2472. smalltalk.method({
  2473. selector: "basicParse:",
  2474. fn: function (aString) {
  2475. var self = this;
  2476. return smalltalk.parser.parse(aString);
  2477. return self;
  2478. }
  2479. }),
  2480. smalltalk.Smalltalk);
  2481. smalltalk.addMethod(
  2482. "_classes",
  2483. smalltalk.method({
  2484. selector: "classes",
  2485. fn: function () {
  2486. var self = this;
  2487. return self.classes();
  2488. return self;
  2489. }
  2490. }),
  2491. smalltalk.Smalltalk);
  2492. smalltalk.addMethod(
  2493. "_createPackage_",
  2494. smalltalk.method({
  2495. selector: "createPackage:",
  2496. fn: function (packageName) {
  2497. var self = this;
  2498. return smalltalk.addPackage(packageName, nil);
  2499. return self;
  2500. }
  2501. }),
  2502. smalltalk.Smalltalk);
  2503. smalltalk.addMethod(
  2504. "_createPackage_properties_",
  2505. smalltalk.method({
  2506. selector: "createPackage:properties:",
  2507. fn: function (packageName, aDict) {
  2508. var self = this;
  2509. var object = nil;
  2510. object = {};
  2511. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  2512. return smalltalk.addPackage(packageName, object);
  2513. return self;
  2514. }
  2515. }),
  2516. smalltalk.Smalltalk);
  2517. smalltalk.addMethod(
  2518. "_deletePackage_",
  2519. smalltalk.method({
  2520. selector: "deletePackage:",
  2521. fn: function (packageName) {
  2522. var self = this;
  2523. delete smalltalk.packages[packageName];
  2524. return self;
  2525. }
  2526. }),
  2527. smalltalk.Smalltalk);
  2528. smalltalk.addMethod(
  2529. "_packageAt_",
  2530. smalltalk.method({
  2531. selector: "packageAt:",
  2532. fn: function (packageName) {
  2533. var self = this;
  2534. return self.packages[packageName];
  2535. return self;
  2536. }
  2537. }),
  2538. smalltalk.Smalltalk);
  2539. smalltalk.addMethod(
  2540. "_packageAt_ifAbsent_",
  2541. smalltalk.method({
  2542. selector: "packageAt:ifAbsent:",
  2543. fn: function (packageName, aBlock) {
  2544. var self = this;
  2545. return smalltalk.send(smalltalk.send(self, "_packageAt_", [packageName]), "_ifNil_", [aBlock]);
  2546. return self;
  2547. }
  2548. }),
  2549. smalltalk.Smalltalk);
  2550. smalltalk.addMethod(
  2551. "_packages",
  2552. smalltalk.method({
  2553. selector: "packages",
  2554. fn: function () {
  2555. var self = this;
  2556. return self.packages.all();
  2557. return self;
  2558. }
  2559. }),
  2560. smalltalk.Smalltalk);
  2561. smalltalk.addMethod(
  2562. "_parse_",
  2563. smalltalk.method({
  2564. selector: "parse:",
  2565. fn: function (aString) {
  2566. var self = this;
  2567. var result = nil;
  2568. 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", []);}]);
  2569. return result;
  2570. return self;
  2571. }
  2572. }),
  2573. smalltalk.Smalltalk);
  2574. smalltalk.addMethod(
  2575. "_parseError_parsing_",
  2576. smalltalk.method({
  2577. selector: "parseError:parsing:",
  2578. fn: function (anException, aString) {
  2579. var self = this;
  2580. var row = nil;
  2581. var col = nil;
  2582. var message = nil;
  2583. var lines = nil;
  2584. var badLine = nil;
  2585. var code = nil;
  2586. row = anException.line;
  2587. col = anException.column;
  2588. message = anException.message;
  2589. lines = smalltalk.send(aString, "_lines", []);
  2590. badLine = smalltalk.send(lines, "_at_", [row]);
  2591. 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", [])])]);
  2592. smalltalk.send(lines, "_at_put_", [row, badLine]);
  2593. 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", [])])]);}]);}]);
  2594. 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])]);
  2595. return self;
  2596. }
  2597. }),
  2598. smalltalk.Smalltalk);
  2599. smalltalk.addMethod(
  2600. "_readJSObject_",
  2601. smalltalk.method({
  2602. selector: "readJSObject:",
  2603. fn: function (anObject) {
  2604. var self = this;
  2605. return self.readJSObject(anObject);
  2606. return self;
  2607. }
  2608. }),
  2609. smalltalk.Smalltalk);
  2610. smalltalk.addMethod(
  2611. "_removeClass_",
  2612. smalltalk.method({
  2613. selector: "removeClass:",
  2614. fn: function (aClass) {
  2615. var self = this;
  2616. ($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!"])]);}]);
  2617. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);}]);
  2618. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);}]);
  2619. smalltalk.send(self, "_basicDelete_", [smalltalk.send(aClass, "_name", [])]);
  2620. return self;
  2621. }
  2622. }),
  2623. smalltalk.Smalltalk);
  2624. smalltalk.addMethod(
  2625. "_removePackage_",
  2626. smalltalk.method({
  2627. selector: "removePackage:",
  2628. fn: function (packageName) {
  2629. var self = this;
  2630. var pkg = nil;
  2631. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  2632. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [function (each) {return smalltalk.send(self, "_removeClass_", [each]);}]);
  2633. smalltalk.send(self, "_deletePackage_", [packageName]);
  2634. return self;
  2635. }
  2636. }),
  2637. smalltalk.Smalltalk);
  2638. smalltalk.addMethod(
  2639. "_renamePackage_to_",
  2640. smalltalk.method({
  2641. selector: "renamePackage:to:",
  2642. fn: function (packageName, newName) {
  2643. var self = this;
  2644. var pkg = nil;
  2645. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  2646. ($receiver = smalltalk.send(self, "_packageAt_", [newName])) != nil &&
  2647. $receiver != undefined ? function () {return smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);}() : nil;
  2648. smalltalk.packages[newName] = smalltalk.packages[packageName];
  2649. smalltalk.send(pkg, "_name_", [newName]);
  2650. smalltalk.send(self, "_deletePackage_", [packageName]);
  2651. return self;
  2652. }
  2653. }),
  2654. smalltalk.Smalltalk);
  2655. smalltalk.addMethod(
  2656. "_reservedWords",
  2657. smalltalk.method({
  2658. selector: "reservedWords",
  2659. fn: function () {
  2660. var self = this;
  2661. return self.reservedWords;
  2662. return self;
  2663. }
  2664. }),
  2665. smalltalk.Smalltalk);
  2666. smalltalk.addMethod(
  2667. "_send_to_arguments_",
  2668. smalltalk.method({
  2669. selector: "send:to:arguments:",
  2670. fn: function (aSelector, anObject, aCollection) {
  2671. var self = this;
  2672. var selector = nil;
  2673. selector = smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []);
  2674. return self.send(anObject, selector, aCollection);
  2675. return self;
  2676. }
  2677. }),
  2678. smalltalk.Smalltalk);
  2679. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  2680. smalltalk.addMethod(
  2681. "_current",
  2682. smalltalk.method({
  2683. selector: "current",
  2684. fn: function () {
  2685. var self = this;
  2686. return smalltalk;
  2687. return self;
  2688. }
  2689. }),
  2690. smalltalk.Smalltalk.klass);
  2691. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  2692. smalltalk.addMethod(
  2693. "_asJSON",
  2694. smalltalk.method({
  2695. selector: "asJSON",
  2696. fn: function () {
  2697. var self = this;
  2698. return typeof null == "undefined" ? nil : null;
  2699. return self;
  2700. }
  2701. }),
  2702. smalltalk.UndefinedObject);
  2703. smalltalk.addMethod(
  2704. "_deepCopy",
  2705. smalltalk.method({
  2706. selector: "deepCopy",
  2707. fn: function () {
  2708. var self = this;
  2709. return self;
  2710. return self;
  2711. }
  2712. }),
  2713. smalltalk.UndefinedObject);
  2714. smalltalk.addMethod(
  2715. "_ifNil_",
  2716. smalltalk.method({
  2717. selector: "ifNil:",
  2718. fn: function (aBlock) {
  2719. var self = this;
  2720. return smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, function () {return nil;}]);
  2721. return self;
  2722. }
  2723. }),
  2724. smalltalk.UndefinedObject);
  2725. smalltalk.addMethod(
  2726. "_ifNil_ifNotNil_",
  2727. smalltalk.method({
  2728. selector: "ifNil:ifNotNil:",
  2729. fn: function (aBlock, anotherBlock) {
  2730. var self = this;
  2731. return smalltalk.send(aBlock, "_value", []);
  2732. return self;
  2733. }
  2734. }),
  2735. smalltalk.UndefinedObject);
  2736. smalltalk.addMethod(
  2737. "_ifNotNil_",
  2738. smalltalk.method({
  2739. selector: "ifNotNil:",
  2740. fn: function (aBlock) {
  2741. var self = this;
  2742. return self;
  2743. return self;
  2744. }
  2745. }),
  2746. smalltalk.UndefinedObject);
  2747. smalltalk.addMethod(
  2748. "_ifNotNil_ifNil_",
  2749. smalltalk.method({
  2750. selector: "ifNotNil:ifNil:",
  2751. fn: function (aBlock, anotherBlock) {
  2752. var self = this;
  2753. return smalltalk.send(anotherBlock, "_value", []);
  2754. return self;
  2755. }
  2756. }),
  2757. smalltalk.UndefinedObject);
  2758. smalltalk.addMethod(
  2759. "_isNil",
  2760. smalltalk.method({
  2761. selector: "isNil",
  2762. fn: function () {
  2763. var self = this;
  2764. return true;
  2765. return self;
  2766. }
  2767. }),
  2768. smalltalk.UndefinedObject);
  2769. smalltalk.addMethod(
  2770. "_notNil",
  2771. smalltalk.method({
  2772. selector: "notNil",
  2773. fn: function () {
  2774. var self = this;
  2775. return false;
  2776. return self;
  2777. }
  2778. }),
  2779. smalltalk.UndefinedObject);
  2780. smalltalk.addMethod(
  2781. "_printString",
  2782. smalltalk.method({
  2783. selector: "printString",
  2784. fn: function () {
  2785. var self = this;
  2786. return "nil";
  2787. return self;
  2788. }
  2789. }),
  2790. smalltalk.UndefinedObject);
  2791. smalltalk.addMethod(
  2792. "_shallowCopy",
  2793. smalltalk.method({
  2794. selector: "shallowCopy",
  2795. fn: function () {
  2796. var self = this;
  2797. return self;
  2798. return self;
  2799. }
  2800. }),
  2801. smalltalk.UndefinedObject);
  2802. smalltalk.addMethod(
  2803. "_subclass_instanceVariableNames_",
  2804. smalltalk.method({
  2805. selector: "subclass:instanceVariableNames:",
  2806. fn: function (aString, anotherString) {
  2807. var self = this;
  2808. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  2809. return self;
  2810. }
  2811. }),
  2812. smalltalk.UndefinedObject);
  2813. smalltalk.addMethod(
  2814. "_subclass_instanceVariableNames_category_",
  2815. smalltalk.method({
  2816. selector: "subclass:instanceVariableNames:category:",
  2817. fn: function (aString, aString2, aString3) {
  2818. var self = this;
  2819. smalltalk.send(self, "_deprecatedAPI", []);
  2820. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  2821. return self;
  2822. }
  2823. }),
  2824. smalltalk.UndefinedObject);
  2825. smalltalk.addMethod(
  2826. "_subclass_instanceVariableNames_package_",
  2827. smalltalk.method({
  2828. selector: "subclass:instanceVariableNames:package:",
  2829. fn: function (aString, aString2, aString3) {
  2830. var self = this;
  2831. return smalltalk.send(smalltalk.send(smalltalk.ClassBuilder || ClassBuilder, "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
  2832. return self;
  2833. }
  2834. }),
  2835. smalltalk.UndefinedObject);
  2836. smalltalk.addMethod(
  2837. "_new",
  2838. smalltalk.method({
  2839. selector: "new",
  2840. fn: function () {
  2841. var self = this;
  2842. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  2843. return self;
  2844. }
  2845. }),
  2846. smalltalk.UndefinedObject.klass);