Kernel-Methods.deploy.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. smalltalk.addPackage('Kernel-Methods', {});
  2. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  3. smalltalk.addMethod(
  4. "_applyTo_arguments_",
  5. smalltalk.method({
  6. selector: "applyTo:arguments:",
  7. fn: function (anObject, aCollection) {
  8. var self = this;
  9. return self.apply(anObject, aCollection);
  10. return self;
  11. }
  12. }),
  13. smalltalk.BlockClosure);
  14. smalltalk.addMethod(
  15. "_compiledSource",
  16. smalltalk.method({
  17. selector: "compiledSource",
  18. fn: function () {
  19. var self = this;
  20. return self.toString();
  21. return self;
  22. }
  23. }),
  24. smalltalk.BlockClosure);
  25. smalltalk.addMethod(
  26. "_ensure_",
  27. smalltalk.method({
  28. selector: "ensure:",
  29. fn: function (aBlock) {
  30. var self = this;
  31. var $1;
  32. var success;
  33. success = false;
  34. $1 = smalltalk.send(function () {smalltalk.send(self, "_value", []);success = true;success;return smalltalk.send(aBlock, "_value", []);}, "_on_do_", [smalltalk.Error || Error, function (ex) {if (!smalltalk.assert(success)) {smalltalk.send(aBlock, "_value", []);}return smalltalk.send(ex, "_signal", []);}]);
  35. return $1;
  36. }
  37. }),
  38. smalltalk.BlockClosure);
  39. smalltalk.addMethod(
  40. "_new",
  41. smalltalk.method({
  42. selector: "new",
  43. fn: function () {
  44. var self = this;
  45. return new self;
  46. return self;
  47. }
  48. }),
  49. smalltalk.BlockClosure);
  50. smalltalk.addMethod(
  51. "_newValue_",
  52. smalltalk.method({
  53. selector: "newValue:",
  54. fn: function (anObject) {
  55. var self = this;
  56. return new self(anObject);
  57. return self;
  58. }
  59. }),
  60. smalltalk.BlockClosure);
  61. smalltalk.addMethod(
  62. "_newValue_value_",
  63. smalltalk.method({
  64. selector: "newValue:value:",
  65. fn: function (anObject, anObject2) {
  66. var self = this;
  67. return new self(anObject, anObject2);
  68. return self;
  69. }
  70. }),
  71. smalltalk.BlockClosure);
  72. smalltalk.addMethod(
  73. "_newValue_value_value_",
  74. smalltalk.method({
  75. selector: "newValue:value:value:",
  76. fn: function (anObject, anObject2, anObject3) {
  77. var self = this;
  78. return new self(anObject, anObject2);
  79. return self;
  80. }
  81. }),
  82. smalltalk.BlockClosure);
  83. smalltalk.addMethod(
  84. "_numArgs",
  85. smalltalk.method({
  86. selector: "numArgs",
  87. fn: function () {
  88. var self = this;
  89. return self.length;
  90. return self;
  91. }
  92. }),
  93. smalltalk.BlockClosure);
  94. smalltalk.addMethod(
  95. "_on_do_",
  96. smalltalk.method({
  97. selector: "on:do:",
  98. fn: function (anErrorClass, aBlock) {
  99. var self = this;
  100. var $2, $1;
  101. $1 = smalltalk.send(self, "_try_catch_", [self, function (error) {$2 = smalltalk.send(error, "_isKindOf_", [anErrorClass]);if (smalltalk.assert($2)) {return smalltalk.send(aBlock, "_value_", [error]);} else {return smalltalk.send(error, "_signal", []);}}]);
  102. return $1;
  103. }
  104. }),
  105. smalltalk.BlockClosure);
  106. smalltalk.addMethod(
  107. "_timeToRun",
  108. smalltalk.method({
  109. selector: "timeToRun",
  110. fn: function () {
  111. var self = this;
  112. var $1;
  113. $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
  114. return $1;
  115. }
  116. }),
  117. smalltalk.BlockClosure);
  118. smalltalk.addMethod(
  119. "_value",
  120. smalltalk.method({
  121. selector: "value",
  122. fn: function () {
  123. var self = this;
  124. return self();
  125. return self;
  126. }
  127. }),
  128. smalltalk.BlockClosure);
  129. smalltalk.addMethod(
  130. "_value_",
  131. smalltalk.method({
  132. selector: "value:",
  133. fn: function (anArg) {
  134. var self = this;
  135. return self(anArg);
  136. return self;
  137. }
  138. }),
  139. smalltalk.BlockClosure);
  140. smalltalk.addMethod(
  141. "_value_value_",
  142. smalltalk.method({
  143. selector: "value:value:",
  144. fn: function (firstArg, secondArg) {
  145. var self = this;
  146. return self(firstArg, secondArg);
  147. return self;
  148. }
  149. }),
  150. smalltalk.BlockClosure);
  151. smalltalk.addMethod(
  152. "_value_value_value_",
  153. smalltalk.method({
  154. selector: "value:value:value:",
  155. fn: function (firstArg, secondArg, thirdArg) {
  156. var self = this;
  157. return self(firstArg, secondArg, thirdArg);
  158. return self;
  159. }
  160. }),
  161. smalltalk.BlockClosure);
  162. smalltalk.addMethod(
  163. "_valueWithInterval_",
  164. smalltalk.method({
  165. selector: "valueWithInterval:",
  166. fn: function (aNumber) {
  167. var self = this;
  168. return setInterval(self, aNumber);
  169. return self;
  170. }
  171. }),
  172. smalltalk.BlockClosure);
  173. smalltalk.addMethod(
  174. "_valueWithPossibleArguments_",
  175. smalltalk.method({
  176. selector: "valueWithPossibleArguments:",
  177. fn: function (aCollection) {
  178. var self = this;
  179. return self.apply(null, aCollection);
  180. return self;
  181. }
  182. }),
  183. smalltalk.BlockClosure);
  184. smalltalk.addMethod(
  185. "_valueWithTimeout_",
  186. smalltalk.method({
  187. selector: "valueWithTimeout:",
  188. fn: function (aNumber) {
  189. var self = this;
  190. return setTimeout(self, aNumber);
  191. return self;
  192. }
  193. }),
  194. smalltalk.BlockClosure);
  195. smalltalk.addMethod(
  196. "_whileFalse",
  197. smalltalk.method({
  198. selector: "whileFalse",
  199. fn: function () {
  200. var self = this;
  201. smalltalk.send(self, "_whileFalse_", [function () {}]);
  202. return self;
  203. }
  204. }),
  205. smalltalk.BlockClosure);
  206. smalltalk.addMethod(
  207. "_whileFalse_",
  208. smalltalk.method({
  209. selector: "whileFalse:",
  210. fn: function (aBlock) {
  211. var self = this;
  212. while (!self()) {
  213. aBlock();
  214. }
  215. return self;
  216. }
  217. }),
  218. smalltalk.BlockClosure);
  219. smalltalk.addMethod(
  220. "_whileTrue",
  221. smalltalk.method({
  222. selector: "whileTrue",
  223. fn: function () {
  224. var self = this;
  225. smalltalk.send(self, "_whileTrue_", [function () {}]);
  226. return self;
  227. }
  228. }),
  229. smalltalk.BlockClosure);
  230. smalltalk.addMethod(
  231. "_whileTrue_",
  232. smalltalk.method({
  233. selector: "whileTrue:",
  234. fn: function (aBlock) {
  235. var self = this;
  236. while (self()) {
  237. aBlock();
  238. }
  239. return self;
  240. }
  241. }),
  242. smalltalk.BlockClosure);
  243. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  244. smalltalk.addMethod(
  245. "_arguments",
  246. smalltalk.method({
  247. selector: "arguments",
  248. fn: function () {
  249. var self = this;
  250. return self.args || [];
  251. return self;
  252. }
  253. }),
  254. smalltalk.CompiledMethod);
  255. smalltalk.addMethod(
  256. "_category",
  257. smalltalk.method({
  258. selector: "category",
  259. fn: function () {
  260. var self = this;
  261. var $2, $1;
  262. $2 = smalltalk.send(self, "_basicAt_", ["category"]);
  263. if (($receiver = $2) == nil || $receiver == undefined) {
  264. $1 = "";
  265. } else {
  266. $1 = $2;
  267. }
  268. return $1;
  269. }
  270. }),
  271. smalltalk.CompiledMethod);
  272. smalltalk.addMethod(
  273. "_category_",
  274. smalltalk.method({
  275. selector: "category:",
  276. fn: function (aString) {
  277. var self = this;
  278. var $1;
  279. var oldCategory;
  280. oldCategory = smalltalk.send(self, "_category", []);
  281. smalltalk.send(self, "_basicAt_put_", ["category", aString]);
  282. $1 = smalltalk.send(self, "_methodClass", []);
  283. if (($receiver = $1) == nil || $receiver == undefined) {
  284. } else {
  285. smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_organizer", []), "_addElement_", [aString]);
  286. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_methods", []), "_select_", [function (each) {return smalltalk.send(smalltalk.send(each, "_category", []), "__eq", [oldCategory]);}]), "_ifEmpty_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodClass", []), "_organizer", []), "_removeElement_", [oldCategory]);}]);
  287. }
  288. return self;
  289. }
  290. }),
  291. smalltalk.CompiledMethod);
  292. smalltalk.addMethod(
  293. "_fn",
  294. smalltalk.method({
  295. selector: "fn",
  296. fn: function () {
  297. var self = this;
  298. var $1;
  299. $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
  300. return $1;
  301. }
  302. }),
  303. smalltalk.CompiledMethod);
  304. smalltalk.addMethod(
  305. "_fn_",
  306. smalltalk.method({
  307. selector: "fn:",
  308. fn: function (aBlock) {
  309. var self = this;
  310. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  311. return self;
  312. }
  313. }),
  314. smalltalk.CompiledMethod);
  315. smalltalk.addMethod(
  316. "_messageSends",
  317. smalltalk.method({
  318. selector: "messageSends",
  319. fn: function () {
  320. var self = this;
  321. var $1;
  322. $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
  323. return $1;
  324. }
  325. }),
  326. smalltalk.CompiledMethod);
  327. smalltalk.addMethod(
  328. "_methodClass",
  329. smalltalk.method({
  330. selector: "methodClass",
  331. fn: function () {
  332. var self = this;
  333. var $1;
  334. $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
  335. return $1;
  336. }
  337. }),
  338. smalltalk.CompiledMethod);
  339. smalltalk.addMethod(
  340. "_protocol",
  341. smalltalk.method({
  342. selector: "protocol",
  343. fn: function () {
  344. var self = this;
  345. var $1;
  346. $1 = smalltalk.send(self, "_category", []);
  347. return $1;
  348. }
  349. }),
  350. smalltalk.CompiledMethod);
  351. smalltalk.addMethod(
  352. "_referencedClasses",
  353. smalltalk.method({
  354. selector: "referencedClasses",
  355. fn: function () {
  356. var self = this;
  357. var $1;
  358. $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  359. return $1;
  360. }
  361. }),
  362. smalltalk.CompiledMethod);
  363. smalltalk.addMethod(
  364. "_selector",
  365. smalltalk.method({
  366. selector: "selector",
  367. fn: function () {
  368. var self = this;
  369. var $1;
  370. $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
  371. return $1;
  372. }
  373. }),
  374. smalltalk.CompiledMethod);
  375. smalltalk.addMethod(
  376. "_selector_",
  377. smalltalk.method({
  378. selector: "selector:",
  379. fn: function (aString) {
  380. var self = this;
  381. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  382. return self;
  383. }
  384. }),
  385. smalltalk.CompiledMethod);
  386. smalltalk.addMethod(
  387. "_source",
  388. smalltalk.method({
  389. selector: "source",
  390. fn: function () {
  391. var self = this;
  392. var $2, $1;
  393. $2 = smalltalk.send(self, "_basicAt_", ["source"]);
  394. if (($receiver = $2) == nil || $receiver == undefined) {
  395. $1 = "";
  396. } else {
  397. $1 = $2;
  398. }
  399. return $1;
  400. }
  401. }),
  402. smalltalk.CompiledMethod);
  403. smalltalk.addMethod(
  404. "_source_",
  405. smalltalk.method({
  406. selector: "source:",
  407. fn: function (aString) {
  408. var self = this;
  409. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  410. return self;
  411. }
  412. }),
  413. smalltalk.CompiledMethod);
  414. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  415. smalltalk.addMethod(
  416. "_arguments",
  417. smalltalk.method({
  418. selector: "arguments",
  419. fn: function () {
  420. var self = this;
  421. return self['@arguments'];
  422. }
  423. }),
  424. smalltalk.Message);
  425. smalltalk.addMethod(
  426. "_arguments_",
  427. smalltalk.method({
  428. selector: "arguments:",
  429. fn: function (anArray) {
  430. var self = this;
  431. self['@arguments'] = anArray;
  432. return self;
  433. }
  434. }),
  435. smalltalk.Message);
  436. smalltalk.addMethod(
  437. "_printString",
  438. smalltalk.method({
  439. selector: "printString",
  440. fn: function () {
  441. var self = this;
  442. var $2, $1;
  443. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send(aStream, "_nextPutAll_", ["("]);smalltalk.send(aStream, "_nextPutAll_", [self['@selector']]);$2 = smalltalk.send(aStream, "_nextPutAll_", [")"]);return $2;}]);
  444. return $1;
  445. }
  446. }),
  447. smalltalk.Message);
  448. smalltalk.addMethod(
  449. "_selector",
  450. smalltalk.method({
  451. selector: "selector",
  452. fn: function () {
  453. var self = this;
  454. return self['@selector'];
  455. }
  456. }),
  457. smalltalk.Message);
  458. smalltalk.addMethod(
  459. "_selector_",
  460. smalltalk.method({
  461. selector: "selector:",
  462. fn: function (aString) {
  463. var self = this;
  464. self['@selector'] = aString;
  465. return self;
  466. }
  467. }),
  468. smalltalk.Message);
  469. smalltalk.addMethod(
  470. "_sendTo_",
  471. smalltalk.method({
  472. selector: "sendTo:",
  473. fn: function (anObject) {
  474. var self = this;
  475. var $1;
  476. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
  477. return $1;
  478. }
  479. }),
  480. smalltalk.Message);
  481. smalltalk.addMethod(
  482. "_selector_arguments_",
  483. smalltalk.method({
  484. selector: "selector:arguments:",
  485. fn: function (aString, anArray) {
  486. var self = this;
  487. var $2, $3, $1;
  488. $2 = smalltalk.send(self, "_new", []);
  489. smalltalk.send($2, "_selector_", [aString]);
  490. smalltalk.send($2, "_arguments_", [anArray]);
  491. $3 = smalltalk.send($2, "_yourself", []);
  492. $1 = $3;
  493. return $1;
  494. }
  495. }),
  496. smalltalk.Message.klass);
  497. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  498. smalltalk.addMethod(
  499. "_asString",
  500. smalltalk.method({
  501. selector: "asString",
  502. fn: function () {
  503. var self = this;
  504. var $1;
  505. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
  506. return $1;
  507. }
  508. }),
  509. smalltalk.MethodContext);
  510. smalltalk.addMethod(
  511. "_home",
  512. smalltalk.method({
  513. selector: "home",
  514. fn: function () {
  515. var self = this;
  516. return self.homeContext;
  517. return self;
  518. }
  519. }),
  520. smalltalk.MethodContext);
  521. smalltalk.addMethod(
  522. "_pc",
  523. smalltalk.method({
  524. selector: "pc",
  525. fn: function () {
  526. var self = this;
  527. return self.pc;
  528. return self;
  529. }
  530. }),
  531. smalltalk.MethodContext);
  532. smalltalk.addMethod(
  533. "_printString",
  534. smalltalk.method({
  535. selector: "printString",
  536. fn: function () {
  537. var self = this;
  538. var $1;
  539. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
  540. return $1;
  541. }
  542. }),
  543. smalltalk.MethodContext);
  544. smalltalk.addMethod(
  545. "_receiver",
  546. smalltalk.method({
  547. selector: "receiver",
  548. fn: function () {
  549. var self = this;
  550. return self.receiver;
  551. return self;
  552. }
  553. }),
  554. smalltalk.MethodContext);
  555. smalltalk.addMethod(
  556. "_selector",
  557. smalltalk.method({
  558. selector: "selector",
  559. fn: function () {
  560. var self = this;
  561. return smalltalk.convertSelector(self.selector);
  562. return self;
  563. }
  564. }),
  565. smalltalk.MethodContext);
  566. smalltalk.addMethod(
  567. "_temps",
  568. smalltalk.method({
  569. selector: "temps",
  570. fn: function () {
  571. var self = this;
  572. return self.temps;
  573. return self;
  574. }
  575. }),
  576. smalltalk.MethodContext);