1
0

Kernel-Methods.deploy.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  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. $1;
  285. } else {
  286. smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
  287. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
  288. return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
  289. })]),"_ifEmpty_",[(function(){
  290. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
  291. })]);
  292. };
  293. return self}
  294. }),
  295. smalltalk.CompiledMethod);
  296. smalltalk.addMethod(
  297. "_fn",
  298. smalltalk.method({
  299. selector: "fn",
  300. fn: function () {
  301. var self = this;
  302. var $1;
  303. $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
  304. return $1;
  305. }
  306. }),
  307. smalltalk.CompiledMethod);
  308. smalltalk.addMethod(
  309. "_fn_",
  310. smalltalk.method({
  311. selector: "fn:",
  312. fn: function (aBlock) {
  313. var self = this;
  314. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  315. return self;
  316. }
  317. }),
  318. smalltalk.CompiledMethod);
  319. smalltalk.addMethod(
  320. "_messageSends",
  321. smalltalk.method({
  322. selector: "messageSends",
  323. fn: function () {
  324. var self = this;
  325. var $1;
  326. $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
  327. return $1;
  328. }
  329. }),
  330. smalltalk.CompiledMethod);
  331. smalltalk.addMethod(
  332. "_methodClass",
  333. smalltalk.method({
  334. selector: "methodClass",
  335. fn: function () {
  336. var self = this;
  337. var $1;
  338. $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
  339. return $1;
  340. }
  341. }),
  342. smalltalk.CompiledMethod);
  343. smalltalk.addMethod(
  344. "_protocol",
  345. smalltalk.method({
  346. selector: "protocol",
  347. fn: function () {
  348. var self = this;
  349. var $1;
  350. $1 = smalltalk.send(self, "_category", []);
  351. return $1;
  352. }
  353. }),
  354. smalltalk.CompiledMethod);
  355. smalltalk.addMethod(
  356. "_referencedClasses",
  357. smalltalk.method({
  358. selector: "referencedClasses",
  359. fn: function () {
  360. var self = this;
  361. var $1;
  362. $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  363. return $1;
  364. }
  365. }),
  366. smalltalk.CompiledMethod);
  367. smalltalk.addMethod(
  368. "_selector",
  369. smalltalk.method({
  370. selector: "selector",
  371. fn: function () {
  372. var self = this;
  373. var $1;
  374. $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
  375. return $1;
  376. }
  377. }),
  378. smalltalk.CompiledMethod);
  379. smalltalk.addMethod(
  380. "_selector_",
  381. smalltalk.method({
  382. selector: "selector:",
  383. fn: function (aString) {
  384. var self = this;
  385. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  386. return self;
  387. }
  388. }),
  389. smalltalk.CompiledMethod);
  390. smalltalk.addMethod(
  391. "_source",
  392. smalltalk.method({
  393. selector: "source",
  394. fn: function () {
  395. var self = this;
  396. var $2, $1;
  397. $2 = smalltalk.send(self, "_basicAt_", ["source"]);
  398. if (($receiver = $2) == nil || $receiver == undefined) {
  399. $1 = "";
  400. } else {
  401. $1 = $2;
  402. }
  403. return $1;
  404. }
  405. }),
  406. smalltalk.CompiledMethod);
  407. smalltalk.addMethod(
  408. "_source_",
  409. smalltalk.method({
  410. selector: "source:",
  411. fn: function (aString) {
  412. var self = this;
  413. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  414. return self;
  415. }
  416. }),
  417. smalltalk.CompiledMethod);
  418. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  419. smalltalk.addMethod(
  420. "_arguments",
  421. smalltalk.method({
  422. selector: "arguments",
  423. fn: function () {
  424. var self = this;
  425. return self['@arguments'];
  426. }
  427. }),
  428. smalltalk.Message);
  429. smalltalk.addMethod(
  430. "_arguments_",
  431. smalltalk.method({
  432. selector: "arguments:",
  433. fn: function (anArray) {
  434. var self = this;
  435. self['@arguments'] = anArray;
  436. return self;
  437. }
  438. }),
  439. smalltalk.Message);
  440. smalltalk.addMethod(
  441. "_printString",
  442. smalltalk.method({
  443. selector: "printString",
  444. fn: function () {
  445. var self = this;
  446. var $2, $1;
  447. $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;}]);
  448. return $1;
  449. }
  450. }),
  451. smalltalk.Message);
  452. smalltalk.addMethod(
  453. "_selector",
  454. smalltalk.method({
  455. selector: "selector",
  456. fn: function () {
  457. var self = this;
  458. return self['@selector'];
  459. }
  460. }),
  461. smalltalk.Message);
  462. smalltalk.addMethod(
  463. "_selector_",
  464. smalltalk.method({
  465. selector: "selector:",
  466. fn: function (aString) {
  467. var self = this;
  468. self['@selector'] = aString;
  469. return self;
  470. }
  471. }),
  472. smalltalk.Message);
  473. smalltalk.addMethod(
  474. "_sendTo_",
  475. smalltalk.method({
  476. selector: "sendTo:",
  477. fn: function (anObject) {
  478. var self = this;
  479. var $1;
  480. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
  481. return $1;
  482. }
  483. }),
  484. smalltalk.Message);
  485. smalltalk.addMethod(
  486. "_selector_arguments_",
  487. smalltalk.method({
  488. selector: "selector:arguments:",
  489. fn: function (aString, anArray) {
  490. var self = this;
  491. var $2, $3, $1;
  492. $2 = smalltalk.send(self, "_new", []);
  493. smalltalk.send($2, "_selector_", [aString]);
  494. smalltalk.send($2, "_arguments_", [anArray]);
  495. $3 = smalltalk.send($2, "_yourself", []);
  496. $1 = $3;
  497. return $1;
  498. }
  499. }),
  500. smalltalk.Message.klass);
  501. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  502. smalltalk.addMethod(
  503. "_asString",
  504. smalltalk.method({
  505. selector: "asString",
  506. fn: function () {
  507. var self = this;
  508. var $1;
  509. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
  510. return $1;
  511. }
  512. }),
  513. smalltalk.MethodContext);
  514. smalltalk.addMethod(
  515. "_home",
  516. smalltalk.method({
  517. selector: "home",
  518. fn: function () {
  519. var self = this;
  520. return self.homeContext;
  521. return self;
  522. }
  523. }),
  524. smalltalk.MethodContext);
  525. smalltalk.addMethod(
  526. "_inspectOn_",
  527. smalltalk.method({
  528. selector: "inspectOn:",
  529. fn: function (anInspector) {
  530. var self = this;
  531. var $1;
  532. var variables;
  533. variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  534. smalltalk.send(variables, "_at_put_", ["#self", self]);
  535. smalltalk.send(variables, "_at_put_", ["#home", smalltalk.send(self, "_home", [])]);
  536. smalltalk.send(variables, "_at_put_", ["#receiver", smalltalk.send(self, "_receiver", [])]);
  537. smalltalk.send(variables, "_at_put_", ["#selector", smalltalk.send(self, "_selector", [])]);
  538. smalltalk.send(variables, "_at_put_", ["#temps", smalltalk.send(self, "_temps", [])]);
  539. smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_instanceVariableNames", []), "_do_", [function (each) {return smalltalk.send(variables, "_at_put_", [each, smalltalk.send(self, "_instVarAt_", [each])]);}]);
  540. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  541. $1 = smalltalk.send(anInspector, "_setVariables_", [variables]);
  542. return self;
  543. }
  544. }),
  545. smalltalk.MethodContext);
  546. smalltalk.addMethod(
  547. "_pc",
  548. smalltalk.method({
  549. selector: "pc",
  550. fn: function () {
  551. var self = this;
  552. return self.pc;
  553. return self;
  554. }
  555. }),
  556. smalltalk.MethodContext);
  557. smalltalk.addMethod(
  558. "_printString",
  559. smalltalk.method({
  560. selector: "printString",
  561. fn: function () {
  562. var self = this;
  563. var $1;
  564. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
  565. return $1;
  566. }
  567. }),
  568. smalltalk.MethodContext);
  569. smalltalk.addMethod(
  570. "_receiver",
  571. smalltalk.method({
  572. selector: "receiver",
  573. fn: function () {
  574. var self = this;
  575. return self.receiver;
  576. return self;
  577. }
  578. }),
  579. smalltalk.MethodContext);
  580. smalltalk.addMethod(
  581. "_selector",
  582. smalltalk.method({
  583. selector: "selector",
  584. fn: function () {
  585. var self = this;
  586. return smalltalk.convertSelector(self.selector);
  587. return self;
  588. }
  589. }),
  590. smalltalk.MethodContext);
  591. smalltalk.addMethod(
  592. "_temps",
  593. smalltalk.method({
  594. selector: "temps",
  595. fn: function () {
  596. var self = this;
  597. return self.temps;
  598. return self;
  599. }
  600. }),
  601. smalltalk.MethodContext);