Kernel-Methods.deploy.js 13 KB

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