Kernel-Objects.deploy.js 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086
  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. "_yourself",
  599. smalltalk.method({
  600. selector: "yourself",
  601. fn: function () {
  602. var self = this;
  603. return self;
  604. return self;
  605. }
  606. }),
  607. smalltalk.Object);
  608. smalltalk.addMethod(
  609. "_~_eq",
  610. smalltalk.method({
  611. selector: "~=",
  612. fn: function (anObject) {
  613. var self = this;
  614. return smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq", [false]);
  615. return self;
  616. }
  617. }),
  618. smalltalk.Object);
  619. smalltalk.addMethod(
  620. "_~~",
  621. smalltalk.method({
  622. selector: "~~",
  623. fn: function (anObject) {
  624. var self = this;
  625. return smalltalk.send(smalltalk.send(self, "__eq_eq", [anObject]), "__eq", [false]);
  626. return self;
  627. }
  628. }),
  629. smalltalk.Object);
  630. smalltalk.addMethod(
  631. "_initialize",
  632. smalltalk.method({
  633. selector: "initialize",
  634. fn: function () {
  635. var self = this;
  636. return self;
  637. }
  638. }),
  639. smalltalk.Object.klass);
  640. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  641. smalltalk.addMethod(
  642. "_&",
  643. smalltalk.method({
  644. selector: "&",
  645. fn: function (aBoolean) {
  646. var self = this;
  647. if (self == true) {
  648. return aBoolean;
  649. } else {
  650. return false;
  651. }
  652. return self;
  653. }
  654. }),
  655. smalltalk.Boolean);
  656. smalltalk.addMethod(
  657. "__eq",
  658. smalltalk.method({
  659. selector: "=",
  660. fn: function (aBoolean) {
  661. var self = this;
  662. var $early = {};
  663. try {
  664. ($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];}();}]);
  665. return Boolean(self == true) == aBoolean;
  666. return self;
  667. } catch (e) {
  668. if (e === $early) {
  669. return e[0];
  670. }
  671. throw e;
  672. }
  673. }
  674. }),
  675. smalltalk.Boolean);
  676. smalltalk.addMethod(
  677. "__eq_eq",
  678. smalltalk.method({
  679. selector: "==",
  680. fn: function (aBoolean) {
  681. var self = this;
  682. return smalltalk.send(self, "__eq", [aBoolean]);
  683. return self;
  684. }
  685. }),
  686. smalltalk.Boolean);
  687. smalltalk.addMethod(
  688. "_and_",
  689. smalltalk.method({
  690. selector: "and:",
  691. fn: function (aBlock) {
  692. var self = this;
  693. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [aBlock, function () {return false;}]);
  694. return self;
  695. }
  696. }),
  697. smalltalk.Boolean);
  698. smalltalk.addMethod(
  699. "_asJSON",
  700. smalltalk.method({
  701. selector: "asJSON",
  702. fn: function () {
  703. var self = this;
  704. return self;
  705. return self;
  706. }
  707. }),
  708. smalltalk.Boolean);
  709. smalltalk.addMethod(
  710. "_deepCopy",
  711. smalltalk.method({
  712. selector: "deepCopy",
  713. fn: function () {
  714. var self = this;
  715. return self;
  716. return self;
  717. }
  718. }),
  719. smalltalk.Boolean);
  720. smalltalk.addMethod(
  721. "_ifFalse_",
  722. smalltalk.method({
  723. selector: "ifFalse:",
  724. fn: function (aBlock) {
  725. var self = this;
  726. return smalltalk.send(self, "_ifTrue_ifFalse_", [function () {return nil;}, aBlock]);
  727. return self;
  728. }
  729. }),
  730. smalltalk.Boolean);
  731. smalltalk.addMethod(
  732. "_ifFalse_ifTrue_",
  733. smalltalk.method({
  734. selector: "ifFalse:ifTrue:",
  735. fn: function (aBlock, anotherBlock) {
  736. var self = this;
  737. return smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  738. return self;
  739. }
  740. }),
  741. smalltalk.Boolean);
  742. smalltalk.addMethod(
  743. "_ifTrue_",
  744. smalltalk.method({
  745. selector: "ifTrue:",
  746. fn: function (aBlock) {
  747. var self = this;
  748. return smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, function () {return nil;}]);
  749. return self;
  750. }
  751. }),
  752. smalltalk.Boolean);
  753. smalltalk.addMethod(
  754. "_ifTrue_ifFalse_",
  755. smalltalk.method({
  756. selector: "ifTrue:ifFalse:",
  757. fn: function (aBlock, anotherBlock) {
  758. var self = this;
  759. if (self == true) {
  760. return aBlock();
  761. } else {
  762. return anotherBlock();
  763. }
  764. return self;
  765. }
  766. }),
  767. smalltalk.Boolean);
  768. smalltalk.addMethod(
  769. "_not",
  770. smalltalk.method({
  771. selector: "not",
  772. fn: function () {
  773. var self = this;
  774. return smalltalk.send(self, "__eq", [false]);
  775. return self;
  776. }
  777. }),
  778. smalltalk.Boolean);
  779. smalltalk.addMethod(
  780. "_or_",
  781. smalltalk.method({
  782. selector: "or:",
  783. fn: function (aBlock) {
  784. var self = this;
  785. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [function () {return true;}, aBlock]);
  786. return self;
  787. }
  788. }),
  789. smalltalk.Boolean);
  790. smalltalk.addMethod(
  791. "_printString",
  792. smalltalk.method({
  793. selector: "printString",
  794. fn: function () {
  795. var self = this;
  796. return self.toString();
  797. return self;
  798. }
  799. }),
  800. smalltalk.Boolean);
  801. smalltalk.addMethod(
  802. "_shallowCopy",
  803. smalltalk.method({
  804. selector: "shallowCopy",
  805. fn: function () {
  806. var self = this;
  807. return self;
  808. return self;
  809. }
  810. }),
  811. smalltalk.Boolean);
  812. smalltalk.addMethod(
  813. "_|",
  814. smalltalk.method({
  815. selector: "|",
  816. fn: function (aBoolean) {
  817. var self = this;
  818. if (self == true) {
  819. return true;
  820. } else {
  821. return aBoolean;
  822. }
  823. return self;
  824. }
  825. }),
  826. smalltalk.Boolean);
  827. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  828. smalltalk.addMethod(
  829. "__plus",
  830. smalltalk.method({
  831. selector: "+",
  832. fn: function (aDate) {
  833. var self = this;
  834. return self + aDate;
  835. return self;
  836. }
  837. }),
  838. smalltalk.Date);
  839. smalltalk.addMethod(
  840. "__minus",
  841. smalltalk.method({
  842. selector: "-",
  843. fn: function (aDate) {
  844. var self = this;
  845. return self - aDate;
  846. return self;
  847. }
  848. }),
  849. smalltalk.Date);
  850. smalltalk.addMethod(
  851. "__lt",
  852. smalltalk.method({
  853. selector: "<",
  854. fn: function (aDate) {
  855. var self = this;
  856. return self < aDate;
  857. return self;
  858. }
  859. }),
  860. smalltalk.Date);
  861. smalltalk.addMethod(
  862. "__lt_eq",
  863. smalltalk.method({
  864. selector: "<=",
  865. fn: function (aDate) {
  866. var self = this;
  867. return self <= aDate;
  868. return self;
  869. }
  870. }),
  871. smalltalk.Date);
  872. smalltalk.addMethod(
  873. "__gt",
  874. smalltalk.method({
  875. selector: ">",
  876. fn: function (aDate) {
  877. var self = this;
  878. return self > aDate;
  879. return self;
  880. }
  881. }),
  882. smalltalk.Date);
  883. smalltalk.addMethod(
  884. "__gt_eq",
  885. smalltalk.method({
  886. selector: ">=",
  887. fn: function (aDate) {
  888. var self = this;
  889. return self >= aDate;
  890. return self;
  891. }
  892. }),
  893. smalltalk.Date);
  894. smalltalk.addMethod(
  895. "_asDateString",
  896. smalltalk.method({
  897. selector: "asDateString",
  898. fn: function () {
  899. var self = this;
  900. return self.toDateString();
  901. return self;
  902. }
  903. }),
  904. smalltalk.Date);
  905. smalltalk.addMethod(
  906. "_asLocaleString",
  907. smalltalk.method({
  908. selector: "asLocaleString",
  909. fn: function () {
  910. var self = this;
  911. return self.toLocaleString();
  912. return self;
  913. }
  914. }),
  915. smalltalk.Date);
  916. smalltalk.addMethod(
  917. "_asMilliseconds",
  918. smalltalk.method({
  919. selector: "asMilliseconds",
  920. fn: function () {
  921. var self = this;
  922. return smalltalk.send(self, "_time", []);
  923. return self;
  924. }
  925. }),
  926. smalltalk.Date);
  927. smalltalk.addMethod(
  928. "_asNumber",
  929. smalltalk.method({
  930. selector: "asNumber",
  931. fn: function () {
  932. var self = this;
  933. return smalltalk.send(self, "_asMilliseconds", []);
  934. return self;
  935. }
  936. }),
  937. smalltalk.Date);
  938. smalltalk.addMethod(
  939. "_asString",
  940. smalltalk.method({
  941. selector: "asString",
  942. fn: function () {
  943. var self = this;
  944. return self.toString();
  945. return self;
  946. }
  947. }),
  948. smalltalk.Date);
  949. smalltalk.addMethod(
  950. "_asTimeString",
  951. smalltalk.method({
  952. selector: "asTimeString",
  953. fn: function () {
  954. var self = this;
  955. return self.toTimeString();
  956. return self;
  957. }
  958. }),
  959. smalltalk.Date);
  960. smalltalk.addMethod(
  961. "_day",
  962. smalltalk.method({
  963. selector: "day",
  964. fn: function () {
  965. var self = this;
  966. return smalltalk.send(self, "_dayOfWeek", []);
  967. return self;
  968. }
  969. }),
  970. smalltalk.Date);
  971. smalltalk.addMethod(
  972. "_day_",
  973. smalltalk.method({
  974. selector: "day:",
  975. fn: function (aNumber) {
  976. var self = this;
  977. smalltalk.send(self, "_dayOfWeek_", [aNumber]);
  978. return self;
  979. }
  980. }),
  981. smalltalk.Date);
  982. smalltalk.addMethod(
  983. "_dayOfMonth",
  984. smalltalk.method({
  985. selector: "dayOfMonth",
  986. fn: function () {
  987. var self = this;
  988. return self.getDate();
  989. return self;
  990. }
  991. }),
  992. smalltalk.Date);
  993. smalltalk.addMethod(
  994. "_dayOfMonth_",
  995. smalltalk.method({
  996. selector: "dayOfMonth:",
  997. fn: function (aNumber) {
  998. var self = this;
  999. self.setDate(aNumber);
  1000. return self;
  1001. }
  1002. }),
  1003. smalltalk.Date);
  1004. smalltalk.addMethod(
  1005. "_dayOfWeek",
  1006. smalltalk.method({
  1007. selector: "dayOfWeek",
  1008. fn: function () {
  1009. var self = this;
  1010. return self.getDay() + 1;
  1011. return self;
  1012. }
  1013. }),
  1014. smalltalk.Date);
  1015. smalltalk.addMethod(
  1016. "_dayOfWeek_",
  1017. smalltalk.method({
  1018. selector: "dayOfWeek:",
  1019. fn: function (aNumber) {
  1020. var self = this;
  1021. return self.setDay(aNumber - 1);
  1022. return self;
  1023. }
  1024. }),
  1025. smalltalk.Date);
  1026. smalltalk.addMethod(
  1027. "_hours",
  1028. smalltalk.method({
  1029. selector: "hours",
  1030. fn: function () {
  1031. var self = this;
  1032. return self.getHours();
  1033. return self;
  1034. }
  1035. }),
  1036. smalltalk.Date);
  1037. smalltalk.addMethod(
  1038. "_hours_",
  1039. smalltalk.method({
  1040. selector: "hours:",
  1041. fn: function (aNumber) {
  1042. var self = this;
  1043. self.setHours(aNumber);
  1044. return self;
  1045. }
  1046. }),
  1047. smalltalk.Date);
  1048. smalltalk.addMethod(
  1049. "_milliseconds",
  1050. smalltalk.method({
  1051. selector: "milliseconds",
  1052. fn: function () {
  1053. var self = this;
  1054. return self.getMilliseconds();
  1055. return self;
  1056. }
  1057. }),
  1058. smalltalk.Date);
  1059. smalltalk.addMethod(
  1060. "_milliseconds_",
  1061. smalltalk.method({
  1062. selector: "milliseconds:",
  1063. fn: function (aNumber) {
  1064. var self = this;
  1065. self.setMilliseconds(aNumber);
  1066. return self;
  1067. }
  1068. }),
  1069. smalltalk.Date);
  1070. smalltalk.addMethod(
  1071. "_minutes",
  1072. smalltalk.method({
  1073. selector: "minutes",
  1074. fn: function () {
  1075. var self = this;
  1076. return self.getMinutes();
  1077. return self;
  1078. }
  1079. }),
  1080. smalltalk.Date);
  1081. smalltalk.addMethod(
  1082. "_minutes_",
  1083. smalltalk.method({
  1084. selector: "minutes:",
  1085. fn: function (aNumber) {
  1086. var self = this;
  1087. self.setMinutes(aNumber);
  1088. return self;
  1089. }
  1090. }),
  1091. smalltalk.Date);
  1092. smalltalk.addMethod(
  1093. "_month",
  1094. smalltalk.method({
  1095. selector: "month",
  1096. fn: function () {
  1097. var self = this;
  1098. return self.getMonth() + 1;
  1099. return self;
  1100. }
  1101. }),
  1102. smalltalk.Date);
  1103. smalltalk.addMethod(
  1104. "_month_",
  1105. smalltalk.method({
  1106. selector: "month:",
  1107. fn: function (aNumber) {
  1108. var self = this;
  1109. self.setMonth(aNumber - 1);
  1110. return self;
  1111. }
  1112. }),
  1113. smalltalk.Date);
  1114. smalltalk.addMethod(
  1115. "_printString",
  1116. smalltalk.method({
  1117. selector: "printString",
  1118. fn: function () {
  1119. var self = this;
  1120. return smalltalk.send(self, "_asString", []);
  1121. return self;
  1122. }
  1123. }),
  1124. smalltalk.Date);
  1125. smalltalk.addMethod(
  1126. "_seconds",
  1127. smalltalk.method({
  1128. selector: "seconds",
  1129. fn: function () {
  1130. var self = this;
  1131. return self.getSeconds();
  1132. return self;
  1133. }
  1134. }),
  1135. smalltalk.Date);
  1136. smalltalk.addMethod(
  1137. "_seconds_",
  1138. smalltalk.method({
  1139. selector: "seconds:",
  1140. fn: function (aNumber) {
  1141. var self = this;
  1142. self.setSeconds(aNumber);
  1143. return self;
  1144. }
  1145. }),
  1146. smalltalk.Date);
  1147. smalltalk.addMethod(
  1148. "_time",
  1149. smalltalk.method({
  1150. selector: "time",
  1151. fn: function () {
  1152. var self = this;
  1153. return self.getTime();
  1154. return self;
  1155. }
  1156. }),
  1157. smalltalk.Date);
  1158. smalltalk.addMethod(
  1159. "_time_",
  1160. smalltalk.method({
  1161. selector: "time:",
  1162. fn: function (aNumber) {
  1163. var self = this;
  1164. self.setTime(aNumber);
  1165. return self;
  1166. }
  1167. }),
  1168. smalltalk.Date);
  1169. smalltalk.addMethod(
  1170. "_year",
  1171. smalltalk.method({
  1172. selector: "year",
  1173. fn: function () {
  1174. var self = this;
  1175. return self.getFullYear();
  1176. return self;
  1177. }
  1178. }),
  1179. smalltalk.Date);
  1180. smalltalk.addMethod(
  1181. "_year_",
  1182. smalltalk.method({
  1183. selector: "year:",
  1184. fn: function (aNumber) {
  1185. var self = this;
  1186. self.setFullYear(aNumber);
  1187. return self;
  1188. }
  1189. }),
  1190. smalltalk.Date);
  1191. smalltalk.addMethod(
  1192. "_fromMilliseconds_",
  1193. smalltalk.method({
  1194. selector: "fromMilliseconds:",
  1195. fn: function (aNumber) {
  1196. var self = this;
  1197. return smalltalk.send(self, "_new_", [aNumber]);
  1198. return self;
  1199. }
  1200. }),
  1201. smalltalk.Date.klass);
  1202. smalltalk.addMethod(
  1203. "_fromSeconds_",
  1204. smalltalk.method({
  1205. selector: "fromSeconds:",
  1206. fn: function (aNumber) {
  1207. var self = this;
  1208. return smalltalk.send(self, "_fromMilliseconds_", [($receiver = aNumber).klass === smalltalk.Number ? $receiver * 1000 : smalltalk.send($receiver, "__star", [1000])]);
  1209. return self;
  1210. }
  1211. }),
  1212. smalltalk.Date.klass);
  1213. smalltalk.addMethod(
  1214. "_fromString_",
  1215. smalltalk.method({
  1216. selector: "fromString:",
  1217. fn: function (aString) {
  1218. var self = this;
  1219. return smalltalk.send(self, "_new_", [aString]);
  1220. return self;
  1221. }
  1222. }),
  1223. smalltalk.Date.klass);
  1224. smalltalk.addMethod(
  1225. "_millisecondsToRun_",
  1226. smalltalk.method({
  1227. selector: "millisecondsToRun:",
  1228. fn: function (aBlock) {
  1229. var self = this;
  1230. var t = nil;
  1231. t = smalltalk.send(smalltalk.Date || Date, "_now", []);
  1232. smalltalk.send(aBlock, "_value", []);
  1233. return ($receiver = smalltalk.send(smalltalk.Date || Date, "_now", [])).klass === smalltalk.Number ? $receiver - t : smalltalk.send($receiver, "__minus", [t]);
  1234. return self;
  1235. }
  1236. }),
  1237. smalltalk.Date.klass);
  1238. smalltalk.addMethod(
  1239. "_new_",
  1240. smalltalk.method({
  1241. selector: "new:",
  1242. fn: function (anObject) {
  1243. var self = this;
  1244. return new Date(anObject);
  1245. return self;
  1246. }
  1247. }),
  1248. smalltalk.Date.klass);
  1249. smalltalk.addMethod(
  1250. "_now",
  1251. smalltalk.method({
  1252. selector: "now",
  1253. fn: function () {
  1254. var self = this;
  1255. return smalltalk.send(self, "_today", []);
  1256. return self;
  1257. }
  1258. }),
  1259. smalltalk.Date.klass);
  1260. smalltalk.addMethod(
  1261. "_today",
  1262. smalltalk.method({
  1263. selector: "today",
  1264. fn: function () {
  1265. var self = this;
  1266. return smalltalk.send(self, "_new", []);
  1267. return self;
  1268. }
  1269. }),
  1270. smalltalk.Date.klass);
  1271. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  1272. smalltalk.addMethod(
  1273. "_at_",
  1274. smalltalk.method({
  1275. selector: "at:",
  1276. fn: function (aSymbol) {
  1277. var self = this;
  1278. var attr = nil;
  1279. attr = smalltalk.send(aSymbol, "_asString", []);
  1280. return self['@jsObject'][attr];
  1281. return self;
  1282. }
  1283. }),
  1284. smalltalk.JSObjectProxy);
  1285. smalltalk.addMethod(
  1286. "_at_put_",
  1287. smalltalk.method({
  1288. selector: "at:put:",
  1289. fn: function (aSymbol, anObject) {
  1290. var self = this;
  1291. var attr = nil;
  1292. attr = smalltalk.send(aSymbol, "_asString", []);
  1293. self['@jsObject'][attr] = anObject;
  1294. return self;
  1295. }
  1296. }),
  1297. smalltalk.JSObjectProxy);
  1298. smalltalk.addMethod(
  1299. "_doesNotUnderstand_",
  1300. smalltalk.method({
  1301. selector: "doesNotUnderstand:",
  1302. fn: function (aMessage) {
  1303. var self = this;
  1304. var obj = nil;
  1305. var selector = nil;
  1306. var jsSelector = nil;
  1307. var arguments = nil;
  1308. obj = smalltalk.send(self, "_jsObject", []);
  1309. selector = smalltalk.send(aMessage, "_selector", []);
  1310. jsSelector = smalltalk.send(selector, "_asJavaScriptSelector", []);
  1311. arguments = smalltalk.send(aMessage, "_arguments", []);
  1312. if (obj[jsSelector] != undefined) {
  1313. return smalltalk.send(obj, jsSelector, arguments);
  1314. }
  1315. smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.JSObjectProxy.superclass || nil);
  1316. return self;
  1317. }
  1318. }),
  1319. smalltalk.JSObjectProxy);
  1320. smalltalk.addMethod(
  1321. "_inspectOn_",
  1322. smalltalk.method({
  1323. selector: "inspectOn:",
  1324. fn: function (anInspector) {
  1325. var self = this;
  1326. var variables = nil;
  1327. variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  1328. smalltalk.send(variables, "_at_put_", ["#self", smalltalk.send(self, "_jsObject", [])]);
  1329. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  1330. for (var i in self['@jsObject']) {
  1331. variables._at_put_(i, self['@jsObject'][i]);
  1332. }
  1333. smalltalk.send(anInspector, "_setVariables_", [variables]);
  1334. return self;
  1335. }
  1336. }),
  1337. smalltalk.JSObjectProxy);
  1338. smalltalk.addMethod(
  1339. "_jsObject",
  1340. smalltalk.method({
  1341. selector: "jsObject",
  1342. fn: function () {
  1343. var self = this;
  1344. return self['@jsObject'];
  1345. return self;
  1346. }
  1347. }),
  1348. smalltalk.JSObjectProxy);
  1349. smalltalk.addMethod(
  1350. "_jsObject_",
  1351. smalltalk.method({
  1352. selector: "jsObject:",
  1353. fn: function (aJSObject) {
  1354. var self = this;
  1355. self['@jsObject'] = aJSObject;
  1356. return self;
  1357. }
  1358. }),
  1359. smalltalk.JSObjectProxy);
  1360. smalltalk.addMethod(
  1361. "_printString",
  1362. smalltalk.method({
  1363. selector: "printString",
  1364. fn: function () {
  1365. var self = this;
  1366. return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_toString", []);
  1367. return self;
  1368. }
  1369. }),
  1370. smalltalk.JSObjectProxy);
  1371. smalltalk.addMethod(
  1372. "_on_",
  1373. smalltalk.method({
  1374. selector: "on:",
  1375. fn: function (aJSObject) {
  1376. var self = this;
  1377. return function ($rec) {smalltalk.send($rec, "_jsObject_", [aJSObject]);return smalltalk.send($rec, "_yourself", []);}(smalltalk.send(self, "_new", []));
  1378. return self;
  1379. }
  1380. }),
  1381. smalltalk.JSObjectProxy.klass);
  1382. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  1383. smalltalk.addMethod(
  1384. "_&",
  1385. smalltalk.method({
  1386. selector: "&",
  1387. fn: function (aNumber) {
  1388. var self = this;
  1389. return self & aNumber;
  1390. return self;
  1391. }
  1392. }),
  1393. smalltalk.Number);
  1394. smalltalk.addMethod(
  1395. "__star",
  1396. smalltalk.method({
  1397. selector: "*",
  1398. fn: function (aNumber) {
  1399. var self = this;
  1400. return self * aNumber;
  1401. return self;
  1402. }
  1403. }),
  1404. smalltalk.Number);
  1405. smalltalk.addMethod(
  1406. "__plus",
  1407. smalltalk.method({
  1408. selector: "+",
  1409. fn: function (aNumber) {
  1410. var self = this;
  1411. return self + aNumber;
  1412. return self;
  1413. }
  1414. }),
  1415. smalltalk.Number);
  1416. smalltalk.addMethod(
  1417. "__minus",
  1418. smalltalk.method({
  1419. selector: "-",
  1420. fn: function (aNumber) {
  1421. var self = this;
  1422. return self - aNumber;
  1423. return self;
  1424. }
  1425. }),
  1426. smalltalk.Number);
  1427. smalltalk.addMethod(
  1428. "__slash",
  1429. smalltalk.method({
  1430. selector: "/",
  1431. fn: function (aNumber) {
  1432. var self = this;
  1433. return self / aNumber;
  1434. return self;
  1435. }
  1436. }),
  1437. smalltalk.Number);
  1438. smalltalk.addMethod(
  1439. "__lt",
  1440. smalltalk.method({
  1441. selector: "<",
  1442. fn: function (aNumber) {
  1443. var self = this;
  1444. return self < aNumber;
  1445. return self;
  1446. }
  1447. }),
  1448. smalltalk.Number);
  1449. smalltalk.addMethod(
  1450. "__lt_eq",
  1451. smalltalk.method({
  1452. selector: "<=",
  1453. fn: function (aNumber) {
  1454. var self = this;
  1455. return self <= aNumber;
  1456. return self;
  1457. }
  1458. }),
  1459. smalltalk.Number);
  1460. smalltalk.addMethod(
  1461. "__eq",
  1462. smalltalk.method({
  1463. selector: "=",
  1464. fn: function (aNumber) {
  1465. var self = this;
  1466. var $early = {};
  1467. try {
  1468. ($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];}();}]);
  1469. return Number(self) == aNumber;
  1470. return self;
  1471. } catch (e) {
  1472. if (e === $early) {
  1473. return e[0];
  1474. }
  1475. throw e;
  1476. }
  1477. }
  1478. }),
  1479. smalltalk.Number);
  1480. smalltalk.addMethod(
  1481. "__gt",
  1482. smalltalk.method({
  1483. selector: ">",
  1484. fn: function (aNumber) {
  1485. var self = this;
  1486. return self > aNumber;
  1487. return self;
  1488. }
  1489. }),
  1490. smalltalk.Number);
  1491. smalltalk.addMethod(
  1492. "__gt_eq",
  1493. smalltalk.method({
  1494. selector: ">=",
  1495. fn: function (aNumber) {
  1496. var self = this;
  1497. return self >= aNumber;
  1498. return self;
  1499. }
  1500. }),
  1501. smalltalk.Number);
  1502. smalltalk.addMethod(
  1503. "__at",
  1504. smalltalk.method({
  1505. selector: "@",
  1506. fn: function (aNumber) {
  1507. var self = this;
  1508. return smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, aNumber]);
  1509. return self;
  1510. }
  1511. }),
  1512. smalltalk.Number);
  1513. smalltalk.addMethod(
  1514. "_\x5c\x5c",
  1515. smalltalk.method({
  1516. selector: "\x5c\x5c",
  1517. fn: function (aNumber) {
  1518. var self = this;
  1519. return self % aNumber;
  1520. return self;
  1521. }
  1522. }),
  1523. smalltalk.Number);
  1524. smalltalk.addMethod(
  1525. "_asJSON",
  1526. smalltalk.method({
  1527. selector: "asJSON",
  1528. fn: function () {
  1529. var self = this;
  1530. return self;
  1531. return self;
  1532. }
  1533. }),
  1534. smalltalk.Number);
  1535. smalltalk.addMethod(
  1536. "_asJavascript",
  1537. smalltalk.method({
  1538. selector: "asJavascript",
  1539. fn: function () {
  1540. var self = this;
  1541. return smalltalk.send(smalltalk.send("(", "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [")"]);
  1542. return self;
  1543. }
  1544. }),
  1545. smalltalk.Number);
  1546. smalltalk.addMethod(
  1547. "_asPoint",
  1548. smalltalk.method({
  1549. selector: "asPoint",
  1550. fn: function () {
  1551. var self = this;
  1552. return smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, self]);
  1553. return self;
  1554. }
  1555. }),
  1556. smalltalk.Number);
  1557. smalltalk.addMethod(
  1558. "_asString",
  1559. smalltalk.method({
  1560. selector: "asString",
  1561. fn: function () {
  1562. var self = this;
  1563. return smalltalk.send(self, "_printString", []);
  1564. return self;
  1565. }
  1566. }),
  1567. smalltalk.Number);
  1568. smalltalk.addMethod(
  1569. "_atRandom",
  1570. smalltalk.method({
  1571. selector: "atRandom",
  1572. fn: function () {
  1573. var self = this;
  1574. 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]);
  1575. return self;
  1576. }
  1577. }),
  1578. smalltalk.Number);
  1579. smalltalk.addMethod(
  1580. "_clearInterval",
  1581. smalltalk.method({
  1582. selector: "clearInterval",
  1583. fn: function () {
  1584. var self = this;
  1585. clearInterval(Number(self));
  1586. return self;
  1587. }
  1588. }),
  1589. smalltalk.Number);
  1590. smalltalk.addMethod(
  1591. "_clearTimeout",
  1592. smalltalk.method({
  1593. selector: "clearTimeout",
  1594. fn: function () {
  1595. var self = this;
  1596. clearTimeout(Number(self));
  1597. return self;
  1598. }
  1599. }),
  1600. smalltalk.Number);
  1601. smalltalk.addMethod(
  1602. "_copy",
  1603. smalltalk.method({
  1604. selector: "copy",
  1605. fn: function () {
  1606. var self = this;
  1607. return self;
  1608. return self;
  1609. }
  1610. }),
  1611. smalltalk.Number);
  1612. smalltalk.addMethod(
  1613. "_deepCopy",
  1614. smalltalk.method({
  1615. selector: "deepCopy",
  1616. fn: function () {
  1617. var self = this;
  1618. return smalltalk.send(self, "_copy", []);
  1619. return self;
  1620. }
  1621. }),
  1622. smalltalk.Number);
  1623. smalltalk.addMethod(
  1624. "_even",
  1625. smalltalk.method({
  1626. selector: "even",
  1627. fn: function () {
  1628. var self = this;
  1629. return smalltalk.send(0, "__eq", [smalltalk.send(self, "_\\\\", [2])]);
  1630. return self;
  1631. }
  1632. }),
  1633. smalltalk.Number);
  1634. smalltalk.addMethod(
  1635. "_identityHash",
  1636. smalltalk.method({
  1637. selector: "identityHash",
  1638. fn: function () {
  1639. var self = this;
  1640. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", ["n"]);
  1641. return self;
  1642. }
  1643. }),
  1644. smalltalk.Number);
  1645. smalltalk.addMethod(
  1646. "_isNumber",
  1647. smalltalk.method({
  1648. selector: "isNumber",
  1649. fn: function () {
  1650. var self = this;
  1651. return true;
  1652. return self;
  1653. }
  1654. }),
  1655. smalltalk.Number);
  1656. smalltalk.addMethod(
  1657. "_isZero",
  1658. smalltalk.method({
  1659. selector: "isZero",
  1660. fn: function () {
  1661. var self = this;
  1662. return smalltalk.send(self, "__eq", [0]);
  1663. return self;
  1664. }
  1665. }),
  1666. smalltalk.Number);
  1667. smalltalk.addMethod(
  1668. "_max_",
  1669. smalltalk.method({
  1670. selector: "max:",
  1671. fn: function (aNumber) {
  1672. var self = this;
  1673. return Math.max(self, aNumber);
  1674. return self;
  1675. }
  1676. }),
  1677. smalltalk.Number);
  1678. smalltalk.addMethod(
  1679. "_min_",
  1680. smalltalk.method({
  1681. selector: "min:",
  1682. fn: function (aNumber) {
  1683. var self = this;
  1684. return Math.min(self, aNumber);
  1685. return self;
  1686. }
  1687. }),
  1688. smalltalk.Number);
  1689. smalltalk.addMethod(
  1690. "_negated",
  1691. smalltalk.method({
  1692. selector: "negated",
  1693. fn: function () {
  1694. var self = this;
  1695. return 0 - self;
  1696. return self;
  1697. }
  1698. }),
  1699. smalltalk.Number);
  1700. smalltalk.addMethod(
  1701. "_negative",
  1702. smalltalk.method({
  1703. selector: "negative",
  1704. fn: function () {
  1705. var self = this;
  1706. return self < 0;
  1707. return self;
  1708. }
  1709. }),
  1710. smalltalk.Number);
  1711. smalltalk.addMethod(
  1712. "_odd",
  1713. smalltalk.method({
  1714. selector: "odd",
  1715. fn: function () {
  1716. var self = this;
  1717. return smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  1718. return self;
  1719. }
  1720. }),
  1721. smalltalk.Number);
  1722. smalltalk.addMethod(
  1723. "_positive",
  1724. smalltalk.method({
  1725. selector: "positive",
  1726. fn: function () {
  1727. var self = this;
  1728. return self >= 0;
  1729. return self;
  1730. }
  1731. }),
  1732. smalltalk.Number);
  1733. smalltalk.addMethod(
  1734. "_printShowingDecimalPlaces_",
  1735. smalltalk.method({
  1736. selector: "printShowingDecimalPlaces:",
  1737. fn: function (placesDesired) {
  1738. var self = this;
  1739. return self.toFixed(placesDesired);
  1740. return self;
  1741. }
  1742. }),
  1743. smalltalk.Number);
  1744. smalltalk.addMethod(
  1745. "_printString",
  1746. smalltalk.method({
  1747. selector: "printString",
  1748. fn: function () {
  1749. var self = this;
  1750. return String(self);
  1751. return self;
  1752. }
  1753. }),
  1754. smalltalk.Number);
  1755. smalltalk.addMethod(
  1756. "_rounded",
  1757. smalltalk.method({
  1758. selector: "rounded",
  1759. fn: function () {
  1760. var self = this;
  1761. return Math.round(self);
  1762. return self;
  1763. }
  1764. }),
  1765. smalltalk.Number);
  1766. smalltalk.addMethod(
  1767. "_sqrt",
  1768. smalltalk.method({
  1769. selector: "sqrt",
  1770. fn: function () {
  1771. var self = this;
  1772. return Math.sqrt(self);
  1773. return self;
  1774. }
  1775. }),
  1776. smalltalk.Number);
  1777. smalltalk.addMethod(
  1778. "_squared",
  1779. smalltalk.method({
  1780. selector: "squared",
  1781. fn: function () {
  1782. var self = this;
  1783. return self * self;
  1784. return self;
  1785. }
  1786. }),
  1787. smalltalk.Number);
  1788. smalltalk.addMethod(
  1789. "_timesRepeat_",
  1790. smalltalk.method({
  1791. selector: "timesRepeat:",
  1792. fn: function (aBlock) {
  1793. var self = this;
  1794. var integer = nil;
  1795. var count = nil;
  1796. integer = smalltalk.send(self, "_truncated", []);
  1797. count = 1;
  1798. (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]);}());}}());
  1799. return self;
  1800. }
  1801. }),
  1802. smalltalk.Number);
  1803. smalltalk.addMethod(
  1804. "_to_",
  1805. smalltalk.method({
  1806. selector: "to:",
  1807. fn: function (aNumber) {
  1808. var self = this;
  1809. var array = nil;
  1810. var first = nil;
  1811. var last = nil;
  1812. var count = nil;
  1813. first = smalltalk.send(self, "_truncated", []);
  1814. last = ($receiver = smalltalk.send(aNumber, "_truncated", [])).klass === smalltalk.Number ? $receiver + 1 : smalltalk.send($receiver, "__plus", [1]);
  1815. count = 1;
  1816. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  1817. 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]);}]);
  1818. return array;
  1819. return self;
  1820. }
  1821. }),
  1822. smalltalk.Number);
  1823. smalltalk.addMethod(
  1824. "_to_by_",
  1825. smalltalk.method({
  1826. selector: "to:by:",
  1827. fn: function (stop, step) {
  1828. var self = this;
  1829. var array = nil;
  1830. var value = nil;
  1831. var pos = nil;
  1832. value = self;
  1833. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  1834. pos = 1;
  1835. ($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"]);}]);
  1836. ($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]);}());}}();}]);
  1837. return array;
  1838. return self;
  1839. }
  1840. }),
  1841. smalltalk.Number);
  1842. smalltalk.addMethod(
  1843. "_to_by_do_",
  1844. smalltalk.method({
  1845. selector: "to:by:do:",
  1846. fn: function (stop, step, aBlock) {
  1847. var self = this;
  1848. var value = nil;
  1849. value = self;
  1850. ($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"]);}]);
  1851. ($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]);}());}}();}]);
  1852. return self;
  1853. }
  1854. }),
  1855. smalltalk.Number);
  1856. smalltalk.addMethod(
  1857. "_to_do_",
  1858. smalltalk.method({
  1859. selector: "to:do:",
  1860. fn: function (stop, aBlock) {
  1861. var self = this;
  1862. var nextValue = nil;
  1863. nextValue = self;
  1864. (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]);}());}}());
  1865. return self;
  1866. }
  1867. }),
  1868. smalltalk.Number);
  1869. smalltalk.addMethod(
  1870. "_truncated",
  1871. smalltalk.method({
  1872. selector: "truncated",
  1873. fn: function () {
  1874. var self = this;
  1875. var result = nil;
  1876. ($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;}]);
  1877. return result;
  1878. return self;
  1879. }
  1880. }),
  1881. smalltalk.Number);
  1882. smalltalk.addMethod(
  1883. "_|",
  1884. smalltalk.method({
  1885. selector: "|",
  1886. fn: function (aNumber) {
  1887. var self = this;
  1888. return self | aNumber;
  1889. return self;
  1890. }
  1891. }),
  1892. smalltalk.Number);
  1893. smalltalk.addMethod(
  1894. "_pi",
  1895. smalltalk.method({
  1896. selector: "pi",
  1897. fn: function () {
  1898. var self = this;
  1899. return Math.PI;
  1900. return self;
  1901. }
  1902. }),
  1903. smalltalk.Number.klass);
  1904. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  1905. smalltalk.addMethod(
  1906. "_classes",
  1907. smalltalk.method({
  1908. selector: "classes",
  1909. fn: function () {
  1910. var self = this;
  1911. 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]);}]);
  1912. return self;
  1913. }
  1914. }),
  1915. smalltalk.Package);
  1916. smalltalk.addMethod(
  1917. "_commitPathJs",
  1918. smalltalk.method({
  1919. selector: "commitPathJs",
  1920. fn: function () {
  1921. var self = this;
  1922. return ($receiver = self['@commitPathJs']) == nil ||
  1923. $receiver == undefined ? function () {return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);}() : $receiver;
  1924. return self;
  1925. }
  1926. }),
  1927. smalltalk.Package);
  1928. smalltalk.addMethod(
  1929. "_commitPathJs_",
  1930. smalltalk.method({
  1931. selector: "commitPathJs:",
  1932. fn: function (aString) {
  1933. var self = this;
  1934. self['@commitPathJs'] = aString;
  1935. return self;
  1936. }
  1937. }),
  1938. smalltalk.Package);
  1939. smalltalk.addMethod(
  1940. "_commitPathSt",
  1941. smalltalk.method({
  1942. selector: "commitPathSt",
  1943. fn: function () {
  1944. var self = this;
  1945. return ($receiver = self['@commitPathSt']) == nil ||
  1946. $receiver == undefined ? function () {return smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);}() : $receiver;
  1947. return self;
  1948. }
  1949. }),
  1950. smalltalk.Package);
  1951. smalltalk.addMethod(
  1952. "_commitPathSt_",
  1953. smalltalk.method({
  1954. selector: "commitPathSt:",
  1955. fn: function (aString) {
  1956. var self = this;
  1957. self['@commitPathSt'] = aString;
  1958. return self;
  1959. }
  1960. }),
  1961. smalltalk.Package);
  1962. smalltalk.addMethod(
  1963. "_dependencies",
  1964. smalltalk.method({
  1965. selector: "dependencies",
  1966. fn: function () {
  1967. var self = this;
  1968. return smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", function () {return [];}]);
  1969. return self;
  1970. }
  1971. }),
  1972. smalltalk.Package);
  1973. smalltalk.addMethod(
  1974. "_dependencies_",
  1975. smalltalk.method({
  1976. selector: "dependencies:",
  1977. fn: function (anArray) {
  1978. var self = this;
  1979. return smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  1980. return self;
  1981. }
  1982. }),
  1983. smalltalk.Package);
  1984. smalltalk.addMethod(
  1985. "_jsProperties",
  1986. smalltalk.method({
  1987. selector: "jsProperties",
  1988. fn: function () {
  1989. var self = this;
  1990. return self.properties;
  1991. return self;
  1992. }
  1993. }),
  1994. smalltalk.Package);
  1995. smalltalk.addMethod(
  1996. "_jsProperties_",
  1997. smalltalk.method({
  1998. selector: "jsProperties:",
  1999. fn: function (aJSObject) {
  2000. var self = this;
  2001. return self.properties = aJSObject;
  2002. return self;
  2003. }
  2004. }),
  2005. smalltalk.Package);
  2006. smalltalk.addMethod(
  2007. "_name",
  2008. smalltalk.method({
  2009. selector: "name",
  2010. fn: function () {
  2011. var self = this;
  2012. return self.pkgName;
  2013. return self;
  2014. }
  2015. }),
  2016. smalltalk.Package);
  2017. smalltalk.addMethod(
  2018. "_name_",
  2019. smalltalk.method({
  2020. selector: "name:",
  2021. fn: function (aString) {
  2022. var self = this;
  2023. self.pkgName = aString;
  2024. return self;
  2025. }
  2026. }),
  2027. smalltalk.Package);
  2028. smalltalk.addMethod(
  2029. "_printString",
  2030. smalltalk.method({
  2031. selector: "printString",
  2032. fn: function () {
  2033. var self = this;
  2034. return smalltalk.send(self, "_name", []);
  2035. return self;
  2036. }
  2037. }),
  2038. smalltalk.Package);
  2039. smalltalk.addMethod(
  2040. "_properties",
  2041. smalltalk.method({
  2042. selector: "properties",
  2043. fn: function () {
  2044. var self = this;
  2045. return smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  2046. return self;
  2047. }
  2048. }),
  2049. smalltalk.Package);
  2050. smalltalk.addMethod(
  2051. "_properties_",
  2052. smalltalk.method({
  2053. selector: "properties:",
  2054. fn: function (aDict) {
  2055. var self = this;
  2056. var object = nil;
  2057. object = {};
  2058. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  2059. return self.properties = object;
  2060. return self;
  2061. }
  2062. }),
  2063. smalltalk.Package);
  2064. smalltalk.addMethod(
  2065. "_propertiesAsJSON",
  2066. smalltalk.method({
  2067. selector: "propertiesAsJSON",
  2068. fn: function () {
  2069. var self = this;
  2070. return JSON.stringify(self.properties);
  2071. return self;
  2072. }
  2073. }),
  2074. smalltalk.Package);
  2075. smalltalk.addMethod(
  2076. "_propertyAt_",
  2077. smalltalk.method({
  2078. selector: "propertyAt:",
  2079. fn: function (key) {
  2080. var self = this;
  2081. return self.properties[key];
  2082. return self;
  2083. }
  2084. }),
  2085. smalltalk.Package);
  2086. smalltalk.addMethod(
  2087. "_propertyAt_ifAbsent_",
  2088. smalltalk.method({
  2089. selector: "propertyAt:ifAbsent:",
  2090. fn: function (key, block) {
  2091. var self = this;
  2092. return ($receiver = smalltalk.send(self, "_propertyAt_", [key])) == nil ||
  2093. $receiver == undefined ? function () {return smalltalk.send(block, "_value", []);}() : $receiver;
  2094. return self;
  2095. }
  2096. }),
  2097. smalltalk.Package);
  2098. smalltalk.addMethod(
  2099. "_propertyAt_put_",
  2100. smalltalk.method({
  2101. selector: "propertyAt:put:",
  2102. fn: function (key, value) {
  2103. var self = this;
  2104. return self.properties[key] = value;
  2105. return self;
  2106. }
  2107. }),
  2108. smalltalk.Package);
  2109. smalltalk.addMethod(
  2110. "_sortedClasses",
  2111. smalltalk.method({
  2112. selector: "sortedClasses",
  2113. fn: function () {
  2114. var self = this;
  2115. return smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  2116. return self;
  2117. }
  2118. }),
  2119. smalltalk.Package);
  2120. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  2121. smalltalk.addMethod(
  2122. "_commitToLocalStorage_",
  2123. smalltalk.method({
  2124. selector: "commitToLocalStorage:",
  2125. fn: function (aPackageName) {
  2126. var self = this;
  2127. var key = nil;
  2128. var sourceCode = nil;
  2129. key = smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]);
  2130. sourceCode = smalltalk.send(smalltalk.send(smalltalk.Exporter || Exporter, "_new", []), "_exportPackage_", [aPackageName]);
  2131. localStorage[key] = escape(sourceCode);
  2132. return self;
  2133. }
  2134. }),
  2135. smalltalk.Package.klass);
  2136. smalltalk.addMethod(
  2137. "_defaultCommitPathJs",
  2138. smalltalk.method({
  2139. selector: "defaultCommitPathJs",
  2140. fn: function () {
  2141. var self = this;
  2142. return ($receiver = self['@defaultCommitPathJs']) == nil ||
  2143. $receiver == undefined ? function () {return self['@defaultCommitPathJs'] = "js";}() : $receiver;
  2144. return self;
  2145. }
  2146. }),
  2147. smalltalk.Package.klass);
  2148. smalltalk.addMethod(
  2149. "_defaultCommitPathJs_",
  2150. smalltalk.method({
  2151. selector: "defaultCommitPathJs:",
  2152. fn: function (aString) {
  2153. var self = this;
  2154. self['@defaultCommitPathJs'] = aString;
  2155. return self;
  2156. }
  2157. }),
  2158. smalltalk.Package.klass);
  2159. smalltalk.addMethod(
  2160. "_defaultCommitPathSt",
  2161. smalltalk.method({
  2162. selector: "defaultCommitPathSt",
  2163. fn: function () {
  2164. var self = this;
  2165. return ($receiver = self['@defaultCommitPathSt']) == nil ||
  2166. $receiver == undefined ? function () {return self['@defaultCommitPathSt'] = "st";}() : $receiver;
  2167. return self;
  2168. }
  2169. }),
  2170. smalltalk.Package.klass);
  2171. smalltalk.addMethod(
  2172. "_defaultCommitPathSt_",
  2173. smalltalk.method({
  2174. selector: "defaultCommitPathSt:",
  2175. fn: function (aString) {
  2176. var self = this;
  2177. self['@defaultCommitPathSt'] = aString;
  2178. return self;
  2179. }
  2180. }),
  2181. smalltalk.Package.klass);
  2182. smalltalk.addMethod(
  2183. "_fetch_",
  2184. smalltalk.method({
  2185. selector: "fetch:",
  2186. fn: function (aPackageName) {
  2187. var self = this;
  2188. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  2189. return self;
  2190. }
  2191. }),
  2192. smalltalk.Package.klass);
  2193. smalltalk.addMethod(
  2194. "_fetch_prefix_",
  2195. smalltalk.method({
  2196. selector: "fetch:prefix:",
  2197. fn: function (aPackageName, aPrefix) {
  2198. var self = this;
  2199. 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]);}]);
  2200. return self;
  2201. }
  2202. }),
  2203. smalltalk.Package.klass);
  2204. smalltalk.addMethod(
  2205. "_init_",
  2206. smalltalk.method({
  2207. selector: "init:",
  2208. fn: function (aPackageName) {
  2209. var self = this;
  2210. (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;}])));
  2211. return self;
  2212. }
  2213. }),
  2214. smalltalk.Package.klass);
  2215. smalltalk.addMethod(
  2216. "_named_",
  2217. smalltalk.method({
  2218. selector: "named:",
  2219. fn: function (aPackageName) {
  2220. var self = this;
  2221. return smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_", [aPackageName]);
  2222. return self;
  2223. }
  2224. }),
  2225. smalltalk.Package.klass);
  2226. smalltalk.addMethod(
  2227. "_named_ifAbsent_",
  2228. smalltalk.method({
  2229. selector: "named:ifAbsent:",
  2230. fn: function (aPackageName, aBlock) {
  2231. var self = this;
  2232. return smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  2233. return self;
  2234. }
  2235. }),
  2236. smalltalk.Package.klass);
  2237. smalltalk.addMethod(
  2238. "_resetCommitPaths",
  2239. smalltalk.method({
  2240. selector: "resetCommitPaths",
  2241. fn: function () {
  2242. var self = this;
  2243. self['@defaultCommitPathJs'] = nil;
  2244. self['@defaultCommitPathSt'] = nil;
  2245. return self;
  2246. }
  2247. }),
  2248. smalltalk.Package.klass);
  2249. smalltalk.addMethod(
  2250. "_sortedClasses_",
  2251. smalltalk.method({
  2252. selector: "sortedClasses:",
  2253. fn: function (classes) {
  2254. var self = this;
  2255. var children = nil;
  2256. var others = nil;
  2257. var nodes = nil;
  2258. var expandedClasses = nil;
  2259. children = [];
  2260. others = [];
  2261. 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]);}]);}]);
  2262. nodes = smalltalk.send(children, "_collect_", [function (each) {return smalltalk.send(smalltalk.ClassSorterNode || ClassSorterNode, "_on_classes_level_", [each, others, 0]);}]);
  2263. 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", [])]);}]);
  2264. expandedClasses = smalltalk.send(smalltalk.Array || Array, "_new", []);
  2265. smalltalk.send(nodes, "_do_", [function (aNode) {return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);}]);
  2266. return expandedClasses;
  2267. return self;
  2268. }
  2269. }),
  2270. smalltalk.Package.klass);
  2271. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  2272. smalltalk.addMethod(
  2273. "__star",
  2274. smalltalk.method({
  2275. selector: "*",
  2276. fn: function (aPoint) {
  2277. var self = this;
  2278. 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", [])])]);
  2279. return self;
  2280. }
  2281. }),
  2282. smalltalk.Point);
  2283. smalltalk.addMethod(
  2284. "__plus",
  2285. smalltalk.method({
  2286. selector: "+",
  2287. fn: function (aPoint) {
  2288. var self = this;
  2289. 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", [])])]);
  2290. return self;
  2291. }
  2292. }),
  2293. smalltalk.Point);
  2294. smalltalk.addMethod(
  2295. "__minus",
  2296. smalltalk.method({
  2297. selector: "-",
  2298. fn: function (aPoint) {
  2299. var self = this;
  2300. 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", [])])]);
  2301. return self;
  2302. }
  2303. }),
  2304. smalltalk.Point);
  2305. smalltalk.addMethod(
  2306. "__slash",
  2307. smalltalk.method({
  2308. selector: "/",
  2309. fn: function (aPoint) {
  2310. var self = this;
  2311. 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", [])])]);
  2312. return self;
  2313. }
  2314. }),
  2315. smalltalk.Point);
  2316. smalltalk.addMethod(
  2317. "__eq",
  2318. smalltalk.method({
  2319. selector: "=",
  2320. fn: function (aPoint) {
  2321. var self = this;
  2322. 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", [])])]);}]);
  2323. return self;
  2324. }
  2325. }),
  2326. smalltalk.Point);
  2327. smalltalk.addMethod(
  2328. "_asPoint",
  2329. smalltalk.method({
  2330. selector: "asPoint",
  2331. fn: function () {
  2332. var self = this;
  2333. return self;
  2334. return self;
  2335. }
  2336. }),
  2337. smalltalk.Point);
  2338. smalltalk.addMethod(
  2339. "_printString",
  2340. smalltalk.method({
  2341. selector: "printString",
  2342. fn: function () {
  2343. var self = this;
  2344. 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", [])]);}]);
  2345. return self;
  2346. }
  2347. }),
  2348. smalltalk.Point);
  2349. smalltalk.addMethod(
  2350. "_translateBy_",
  2351. smalltalk.method({
  2352. selector: "translateBy:",
  2353. fn: function (delta) {
  2354. var self = this;
  2355. 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']])]);
  2356. return self;
  2357. }
  2358. }),
  2359. smalltalk.Point);
  2360. smalltalk.addMethod(
  2361. "_x",
  2362. smalltalk.method({
  2363. selector: "x",
  2364. fn: function () {
  2365. var self = this;
  2366. return self['@x'];
  2367. return self;
  2368. }
  2369. }),
  2370. smalltalk.Point);
  2371. smalltalk.addMethod(
  2372. "_x_",
  2373. smalltalk.method({
  2374. selector: "x:",
  2375. fn: function (aNumber) {
  2376. var self = this;
  2377. self['@x'] = aNumber;
  2378. return self;
  2379. }
  2380. }),
  2381. smalltalk.Point);
  2382. smalltalk.addMethod(
  2383. "_y",
  2384. smalltalk.method({
  2385. selector: "y",
  2386. fn: function () {
  2387. var self = this;
  2388. return self['@y'];
  2389. return self;
  2390. }
  2391. }),
  2392. smalltalk.Point);
  2393. smalltalk.addMethod(
  2394. "_y_",
  2395. smalltalk.method({
  2396. selector: "y:",
  2397. fn: function (aNumber) {
  2398. var self = this;
  2399. self['@y'] = aNumber;
  2400. return self;
  2401. }
  2402. }),
  2403. smalltalk.Point);
  2404. smalltalk.addMethod(
  2405. "_x_y_",
  2406. smalltalk.method({
  2407. selector: "x:y:",
  2408. fn: function (aNumber, anotherNumber) {
  2409. var self = this;
  2410. return function ($rec) {smalltalk.send($rec, "_x_", [aNumber]);smalltalk.send($rec, "_y_", [anotherNumber]);return smalltalk.send($rec, "_yourself", []);}(smalltalk.send(self, "_new", []));
  2411. return self;
  2412. }
  2413. }),
  2414. smalltalk.Point.klass);
  2415. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  2416. smalltalk.addMethod(
  2417. "_next",
  2418. smalltalk.method({
  2419. selector: "next",
  2420. fn: function () {
  2421. var self = this;
  2422. return Math.random();
  2423. return self;
  2424. }
  2425. }),
  2426. smalltalk.Random);
  2427. smalltalk.addMethod(
  2428. "_next_",
  2429. smalltalk.method({
  2430. selector: "next:",
  2431. fn: function (anInteger) {
  2432. var self = this;
  2433. return smalltalk.send(smalltalk.send(1, "_to_", [anInteger]), "_collect_", [function (each) {return smalltalk.send(self, "_next", []);}]);
  2434. return self;
  2435. }
  2436. }),
  2437. smalltalk.Random);
  2438. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  2439. smalltalk.addMethod(
  2440. "_at_",
  2441. smalltalk.method({
  2442. selector: "at:",
  2443. fn: function (aString) {
  2444. var self = this;
  2445. return self[aString];
  2446. return self;
  2447. }
  2448. }),
  2449. smalltalk.Smalltalk);
  2450. smalltalk.addMethod(
  2451. "_basicParse_",
  2452. smalltalk.method({
  2453. selector: "basicParse:",
  2454. fn: function (aString) {
  2455. var self = this;
  2456. return smalltalk.parser.parse(aString);
  2457. return self;
  2458. }
  2459. }),
  2460. smalltalk.Smalltalk);
  2461. smalltalk.addMethod(
  2462. "_classes",
  2463. smalltalk.method({
  2464. selector: "classes",
  2465. fn: function () {
  2466. var self = this;
  2467. return self.classes();
  2468. return self;
  2469. }
  2470. }),
  2471. smalltalk.Smalltalk);
  2472. smalltalk.addMethod(
  2473. "_createPackage_",
  2474. smalltalk.method({
  2475. selector: "createPackage:",
  2476. fn: function (packageName) {
  2477. var self = this;
  2478. return smalltalk.addPackage(packageName, nil);
  2479. return self;
  2480. }
  2481. }),
  2482. smalltalk.Smalltalk);
  2483. smalltalk.addMethod(
  2484. "_createPackage_properties_",
  2485. smalltalk.method({
  2486. selector: "createPackage:properties:",
  2487. fn: function (packageName, aDict) {
  2488. var self = this;
  2489. var object = nil;
  2490. object = {};
  2491. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  2492. return smalltalk.addPackage(packageName, object);
  2493. return self;
  2494. }
  2495. }),
  2496. smalltalk.Smalltalk);
  2497. smalltalk.addMethod(
  2498. "_deletePackage_",
  2499. smalltalk.method({
  2500. selector: "deletePackage:",
  2501. fn: function (packageName) {
  2502. var self = this;
  2503. delete smalltalk.packages[packageName];
  2504. return self;
  2505. }
  2506. }),
  2507. smalltalk.Smalltalk);
  2508. smalltalk.addMethod(
  2509. "_packageAt_",
  2510. smalltalk.method({
  2511. selector: "packageAt:",
  2512. fn: function (packageName) {
  2513. var self = this;
  2514. return self.packages[packageName];
  2515. return self;
  2516. }
  2517. }),
  2518. smalltalk.Smalltalk);
  2519. smalltalk.addMethod(
  2520. "_packageAt_ifAbsent_",
  2521. smalltalk.method({
  2522. selector: "packageAt:ifAbsent:",
  2523. fn: function (packageName, aBlock) {
  2524. var self = this;
  2525. return smalltalk.send(smalltalk.send(self, "_packageAt_", [packageName]), "_ifNil_", [aBlock]);
  2526. return self;
  2527. }
  2528. }),
  2529. smalltalk.Smalltalk);
  2530. smalltalk.addMethod(
  2531. "_packages",
  2532. smalltalk.method({
  2533. selector: "packages",
  2534. fn: function () {
  2535. var self = this;
  2536. return self.packages.all();
  2537. return self;
  2538. }
  2539. }),
  2540. smalltalk.Smalltalk);
  2541. smalltalk.addMethod(
  2542. "_parse_",
  2543. smalltalk.method({
  2544. selector: "parse:",
  2545. fn: function (aString) {
  2546. var self = this;
  2547. var result = nil;
  2548. 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", []);}]);
  2549. return result;
  2550. return self;
  2551. }
  2552. }),
  2553. smalltalk.Smalltalk);
  2554. smalltalk.addMethod(
  2555. "_parseError_parsing_",
  2556. smalltalk.method({
  2557. selector: "parseError:parsing:",
  2558. fn: function (anException, aString) {
  2559. var self = this;
  2560. var row = nil;
  2561. var col = nil;
  2562. var message = nil;
  2563. var lines = nil;
  2564. var badLine = nil;
  2565. var code = nil;
  2566. row = anException.line;
  2567. col = anException.column;
  2568. message = anException.message;
  2569. lines = smalltalk.send(aString, "_lines", []);
  2570. badLine = smalltalk.send(lines, "_at_", [row]);
  2571. 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", [])])]);
  2572. smalltalk.send(lines, "_at_put_", [row, badLine]);
  2573. 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", [])])]);}]);}]);
  2574. 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])]);
  2575. return self;
  2576. }
  2577. }),
  2578. smalltalk.Smalltalk);
  2579. smalltalk.addMethod(
  2580. "_readJSObject_",
  2581. smalltalk.method({
  2582. selector: "readJSObject:",
  2583. fn: function (anObject) {
  2584. var self = this;
  2585. return self.readJSObject(anObject);
  2586. return self;
  2587. }
  2588. }),
  2589. smalltalk.Smalltalk);
  2590. smalltalk.addMethod(
  2591. "_removeClass_",
  2592. smalltalk.method({
  2593. selector: "removeClass:",
  2594. fn: function (aClass) {
  2595. var self = this;
  2596. ($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!"])]);}]);
  2597. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);}]);
  2598. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);}]);
  2599. smalltalk.send(self, "_basicDelete_", [smalltalk.send(aClass, "_name", [])]);
  2600. return self;
  2601. }
  2602. }),
  2603. smalltalk.Smalltalk);
  2604. smalltalk.addMethod(
  2605. "_removePackage_",
  2606. smalltalk.method({
  2607. selector: "removePackage:",
  2608. fn: function (packageName) {
  2609. var self = this;
  2610. var pkg = nil;
  2611. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  2612. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [function (each) {return smalltalk.send(self, "_removeClass_", [each]);}]);
  2613. smalltalk.send(self, "_deletePackage_", [packageName]);
  2614. return self;
  2615. }
  2616. }),
  2617. smalltalk.Smalltalk);
  2618. smalltalk.addMethod(
  2619. "_renamePackage_to_",
  2620. smalltalk.method({
  2621. selector: "renamePackage:to:",
  2622. fn: function (packageName, newName) {
  2623. var self = this;
  2624. var pkg = nil;
  2625. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  2626. ($receiver = smalltalk.send(self, "_packageAt_", [newName])) != nil &&
  2627. $receiver != undefined ? function () {return smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);}() : nil;
  2628. smalltalk.packages[newName] = smalltalk.packages[packageName];
  2629. smalltalk.send(pkg, "_name_", [newName]);
  2630. smalltalk.send(self, "_deletePackage_", [packageName]);
  2631. return self;
  2632. }
  2633. }),
  2634. smalltalk.Smalltalk);
  2635. smalltalk.addMethod(
  2636. "_reservedWords",
  2637. smalltalk.method({
  2638. selector: "reservedWords",
  2639. fn: function () {
  2640. var self = this;
  2641. return self.reservedWords;
  2642. return self;
  2643. }
  2644. }),
  2645. smalltalk.Smalltalk);
  2646. smalltalk.addMethod(
  2647. "_send_to_arguments_",
  2648. smalltalk.method({
  2649. selector: "send:to:arguments:",
  2650. fn: function (aSelector, anObject, aCollection) {
  2651. var self = this;
  2652. var selector = nil;
  2653. selector = smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []);
  2654. return self.send(anObject, selector, aCollection);
  2655. return self;
  2656. }
  2657. }),
  2658. smalltalk.Smalltalk);
  2659. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  2660. smalltalk.addMethod(
  2661. "_current",
  2662. smalltalk.method({
  2663. selector: "current",
  2664. fn: function () {
  2665. var self = this;
  2666. return smalltalk;
  2667. return self;
  2668. }
  2669. }),
  2670. smalltalk.Smalltalk.klass);
  2671. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  2672. smalltalk.addMethod(
  2673. "_asJSON",
  2674. smalltalk.method({
  2675. selector: "asJSON",
  2676. fn: function () {
  2677. var self = this;
  2678. return typeof null == "undefined" ? nil : null;
  2679. return self;
  2680. }
  2681. }),
  2682. smalltalk.UndefinedObject);
  2683. smalltalk.addMethod(
  2684. "_deepCopy",
  2685. smalltalk.method({
  2686. selector: "deepCopy",
  2687. fn: function () {
  2688. var self = this;
  2689. return self;
  2690. return self;
  2691. }
  2692. }),
  2693. smalltalk.UndefinedObject);
  2694. smalltalk.addMethod(
  2695. "_ifNil_",
  2696. smalltalk.method({
  2697. selector: "ifNil:",
  2698. fn: function (aBlock) {
  2699. var self = this;
  2700. return smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, function () {return nil;}]);
  2701. return self;
  2702. }
  2703. }),
  2704. smalltalk.UndefinedObject);
  2705. smalltalk.addMethod(
  2706. "_ifNil_ifNotNil_",
  2707. smalltalk.method({
  2708. selector: "ifNil:ifNotNil:",
  2709. fn: function (aBlock, anotherBlock) {
  2710. var self = this;
  2711. return smalltalk.send(aBlock, "_value", []);
  2712. return self;
  2713. }
  2714. }),
  2715. smalltalk.UndefinedObject);
  2716. smalltalk.addMethod(
  2717. "_ifNotNil_",
  2718. smalltalk.method({
  2719. selector: "ifNotNil:",
  2720. fn: function (aBlock) {
  2721. var self = this;
  2722. return self;
  2723. return self;
  2724. }
  2725. }),
  2726. smalltalk.UndefinedObject);
  2727. smalltalk.addMethod(
  2728. "_ifNotNil_ifNil_",
  2729. smalltalk.method({
  2730. selector: "ifNotNil:ifNil:",
  2731. fn: function (aBlock, anotherBlock) {
  2732. var self = this;
  2733. return smalltalk.send(anotherBlock, "_value", []);
  2734. return self;
  2735. }
  2736. }),
  2737. smalltalk.UndefinedObject);
  2738. smalltalk.addMethod(
  2739. "_isNil",
  2740. smalltalk.method({
  2741. selector: "isNil",
  2742. fn: function () {
  2743. var self = this;
  2744. return true;
  2745. return self;
  2746. }
  2747. }),
  2748. smalltalk.UndefinedObject);
  2749. smalltalk.addMethod(
  2750. "_notNil",
  2751. smalltalk.method({
  2752. selector: "notNil",
  2753. fn: function () {
  2754. var self = this;
  2755. return false;
  2756. return self;
  2757. }
  2758. }),
  2759. smalltalk.UndefinedObject);
  2760. smalltalk.addMethod(
  2761. "_printString",
  2762. smalltalk.method({
  2763. selector: "printString",
  2764. fn: function () {
  2765. var self = this;
  2766. return "nil";
  2767. return self;
  2768. }
  2769. }),
  2770. smalltalk.UndefinedObject);
  2771. smalltalk.addMethod(
  2772. "_shallowCopy",
  2773. smalltalk.method({
  2774. selector: "shallowCopy",
  2775. fn: function () {
  2776. var self = this;
  2777. return self;
  2778. return self;
  2779. }
  2780. }),
  2781. smalltalk.UndefinedObject);
  2782. smalltalk.addMethod(
  2783. "_subclass_instanceVariableNames_",
  2784. smalltalk.method({
  2785. selector: "subclass:instanceVariableNames:",
  2786. fn: function (aString, anotherString) {
  2787. var self = this;
  2788. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  2789. return self;
  2790. }
  2791. }),
  2792. smalltalk.UndefinedObject);
  2793. smalltalk.addMethod(
  2794. "_subclass_instanceVariableNames_category_",
  2795. smalltalk.method({
  2796. selector: "subclass:instanceVariableNames:category:",
  2797. fn: function (aString, aString2, aString3) {
  2798. var self = this;
  2799. smalltalk.send(self, "_deprecatedAPI", []);
  2800. return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  2801. return self;
  2802. }
  2803. }),
  2804. smalltalk.UndefinedObject);
  2805. smalltalk.addMethod(
  2806. "_subclass_instanceVariableNames_package_",
  2807. smalltalk.method({
  2808. selector: "subclass:instanceVariableNames:package:",
  2809. fn: function (aString, aString2, aString3) {
  2810. var self = this;
  2811. return smalltalk.send(smalltalk.send(smalltalk.ClassBuilder || ClassBuilder, "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
  2812. return self;
  2813. }
  2814. }),
  2815. smalltalk.UndefinedObject);
  2816. smalltalk.addMethod(
  2817. "_new",
  2818. smalltalk.method({
  2819. selector: "new",
  2820. fn: function () {
  2821. var self = this;
  2822. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  2823. return self;
  2824. }
  2825. }),
  2826. smalltalk.UndefinedObject.klass);