1
0

Kernel-Methods.deploy.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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 success = nil;
  32. success = false;
  33. return smalltalk.send(function () {smalltalk.send(self, "_value", []);success = true;return smalltalk.send(aBlock, "_value", []);}, "_on_do_", [smalltalk.Error || Error, function (ex) {($receiver = success).klass === smalltalk.Boolean ? !$receiver ? function () {return smalltalk.send(aBlock, "_value", []);}() : nil : smalltalk.send($receiver, "_ifFalse_", [function () {return smalltalk.send(aBlock, "_value", []);}]);return smalltalk.send(ex, "_signal", []);}]);
  34. return self;
  35. }
  36. }),
  37. smalltalk.BlockClosure);
  38. smalltalk.addMethod(
  39. "_new",
  40. smalltalk.method({
  41. selector: "new",
  42. fn: function () {
  43. var self = this;
  44. return new self;
  45. return self;
  46. }
  47. }),
  48. smalltalk.BlockClosure);
  49. smalltalk.addMethod(
  50. "_newValue_",
  51. smalltalk.method({
  52. selector: "newValue:",
  53. fn: function (anObject) {
  54. var self = this;
  55. return new self(anObject);
  56. return self;
  57. }
  58. }),
  59. smalltalk.BlockClosure);
  60. smalltalk.addMethod(
  61. "_newValue_value_",
  62. smalltalk.method({
  63. selector: "newValue:value:",
  64. fn: function (anObject, anObject2) {
  65. var self = this;
  66. return new self(anObject, anObject2);
  67. return self;
  68. }
  69. }),
  70. smalltalk.BlockClosure);
  71. smalltalk.addMethod(
  72. "_newValue_value_value_",
  73. smalltalk.method({
  74. selector: "newValue:value:value:",
  75. fn: function (anObject, anObject2, anObject3) {
  76. var self = this;
  77. return new self(anObject, anObject2);
  78. return self;
  79. }
  80. }),
  81. smalltalk.BlockClosure);
  82. smalltalk.addMethod(
  83. "_numArgs",
  84. smalltalk.method({
  85. selector: "numArgs",
  86. fn: function () {
  87. var self = this;
  88. return self.length;
  89. return self;
  90. }
  91. }),
  92. smalltalk.BlockClosure);
  93. smalltalk.addMethod(
  94. "_on_do_",
  95. smalltalk.method({
  96. selector: "on:do:",
  97. fn: function (anErrorClass, aBlock) {
  98. var self = this;
  99. return smalltalk.send(self, "_try_catch_", [self, function (error) {return ($receiver = smalltalk.send(error, "_isKindOf_", [anErrorClass])).klass === smalltalk.Boolean ? $receiver ? function () {return smalltalk.send(aBlock, "_value_", [error]);}() : function () {return smalltalk.send(error, "_signal", []);}() : smalltalk.send($receiver, "_ifTrue_ifFalse_", [function () {return smalltalk.send(aBlock, "_value_", [error]);}, function () {return smalltalk.send(error, "_signal", []);}]);}]);
  100. return self;
  101. }
  102. }),
  103. smalltalk.BlockClosure);
  104. smalltalk.addMethod(
  105. "_timeToRun",
  106. smalltalk.method({
  107. selector: "timeToRun",
  108. fn: function () {
  109. var self = this;
  110. return smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
  111. return self;
  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 () {return nil;}]);
  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 () {return nil;}]);
  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. return ($receiver = smalltalk.send(self, "_basicAt_", ["category"])) == nil ||
  259. $receiver == undefined ? function () {return "";}() : $receiver;
  260. return self;
  261. }
  262. }),
  263. smalltalk.CompiledMethod);
  264. smalltalk.addMethod(
  265. "_category_",
  266. smalltalk.method({
  267. selector: "category:",
  268. fn: function (aString) {
  269. var self = this;
  270. smalltalk.send(self, "_basicAt_put_", ["category", aString]);
  271. return self;
  272. }
  273. }),
  274. smalltalk.CompiledMethod);
  275. smalltalk.addMethod(
  276. "_fn",
  277. smalltalk.method({
  278. selector: "fn",
  279. fn: function () {
  280. var self = this;
  281. return smalltalk.send(self, "_basicAt_", ["fn"]);
  282. return self;
  283. }
  284. }),
  285. smalltalk.CompiledMethod);
  286. smalltalk.addMethod(
  287. "_fn_",
  288. smalltalk.method({
  289. selector: "fn:",
  290. fn: function (aBlock) {
  291. var self = this;
  292. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  293. return self;
  294. }
  295. }),
  296. smalltalk.CompiledMethod);
  297. smalltalk.addMethod(
  298. "_messageSends",
  299. smalltalk.method({
  300. selector: "messageSends",
  301. fn: function () {
  302. var self = this;
  303. return smalltalk.send(self, "_basicAt_", ["messageSends"]);
  304. return self;
  305. }
  306. }),
  307. smalltalk.CompiledMethod);
  308. smalltalk.addMethod(
  309. "_methodClass",
  310. smalltalk.method({
  311. selector: "methodClass",
  312. fn: function () {
  313. var self = this;
  314. return smalltalk.send(self, "_basicAt_", ["methodClass"]);
  315. return self;
  316. }
  317. }),
  318. smalltalk.CompiledMethod);
  319. smalltalk.addMethod(
  320. "_referencedClasses",
  321. smalltalk.method({
  322. selector: "referencedClasses",
  323. fn: function () {
  324. var self = this;
  325. return smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  326. return self;
  327. }
  328. }),
  329. smalltalk.CompiledMethod);
  330. smalltalk.addMethod(
  331. "_selector",
  332. smalltalk.method({
  333. selector: "selector",
  334. fn: function () {
  335. var self = this;
  336. return smalltalk.send(self, "_basicAt_", ["selector"]);
  337. return self;
  338. }
  339. }),
  340. smalltalk.CompiledMethod);
  341. smalltalk.addMethod(
  342. "_selector_",
  343. smalltalk.method({
  344. selector: "selector:",
  345. fn: function (aString) {
  346. var self = this;
  347. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  348. return self;
  349. }
  350. }),
  351. smalltalk.CompiledMethod);
  352. smalltalk.addMethod(
  353. "_source",
  354. smalltalk.method({
  355. selector: "source",
  356. fn: function () {
  357. var self = this;
  358. return ($receiver = smalltalk.send(self, "_basicAt_", ["source"])) == nil ||
  359. $receiver == undefined ? function () {return "";}() : $receiver;
  360. return self;
  361. }
  362. }),
  363. smalltalk.CompiledMethod);
  364. smalltalk.addMethod(
  365. "_source_",
  366. smalltalk.method({
  367. selector: "source:",
  368. fn: function (aString) {
  369. var self = this;
  370. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  371. return self;
  372. }
  373. }),
  374. smalltalk.CompiledMethod);
  375. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  376. smalltalk.addMethod(
  377. "_arguments",
  378. smalltalk.method({
  379. selector: "arguments",
  380. fn: function () {
  381. var self = this;
  382. return self['@arguments'];
  383. return self;
  384. }
  385. }),
  386. smalltalk.Message);
  387. smalltalk.addMethod(
  388. "_arguments_",
  389. smalltalk.method({
  390. selector: "arguments:",
  391. fn: function (anArray) {
  392. var self = this;
  393. self['@arguments'] = anArray;
  394. return self;
  395. }
  396. }),
  397. smalltalk.Message);
  398. smalltalk.addMethod(
  399. "_printString",
  400. smalltalk.method({
  401. selector: "printString",
  402. fn: function () {
  403. var self = this;
  404. return smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {return function ($rec) {smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Message.superclass || nil)]);smalltalk.send($rec, "_nextPutAll_", ["("]);smalltalk.send($rec, "_nextPutAll_", [self['@selector']]);return smalltalk.send($rec, "_nextPutAll_", [")"]);}(aStream);}]);
  405. return self;
  406. }
  407. }),
  408. smalltalk.Message);
  409. smalltalk.addMethod(
  410. "_selector",
  411. smalltalk.method({
  412. selector: "selector",
  413. fn: function () {
  414. var self = this;
  415. return self['@selector'];
  416. return self;
  417. }
  418. }),
  419. smalltalk.Message);
  420. smalltalk.addMethod(
  421. "_selector_",
  422. smalltalk.method({
  423. selector: "selector:",
  424. fn: function (aString) {
  425. var self = this;
  426. self['@selector'] = aString;
  427. return self;
  428. }
  429. }),
  430. smalltalk.Message);
  431. smalltalk.addMethod(
  432. "_sendTo_",
  433. smalltalk.method({
  434. selector: "sendTo:",
  435. fn: function (anObject) {
  436. var self = this;
  437. return smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
  438. return self;
  439. }
  440. }),
  441. smalltalk.Message);
  442. smalltalk.addMethod(
  443. "_selector_arguments_",
  444. smalltalk.method({
  445. selector: "selector:arguments:",
  446. fn: function (aString, anArray) {
  447. var self = this;
  448. return function ($rec) {smalltalk.send($rec, "_selector_", [aString]);smalltalk.send($rec, "_arguments_", [anArray]);return smalltalk.send($rec, "_yourself", []);}(smalltalk.send(self, "_new", []));
  449. return self;
  450. }
  451. }),
  452. smalltalk.Message.klass);
  453. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  454. smalltalk.addMethod(
  455. "_asString",
  456. smalltalk.method({
  457. selector: "asString",
  458. fn: function () {
  459. var self = this;
  460. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
  461. return self;
  462. }
  463. }),
  464. smalltalk.MethodContext);
  465. smalltalk.addMethod(
  466. "_home",
  467. smalltalk.method({
  468. selector: "home",
  469. fn: function () {
  470. var self = this;
  471. return self.homeContext;
  472. return self;
  473. }
  474. }),
  475. smalltalk.MethodContext);
  476. smalltalk.addMethod(
  477. "_pc",
  478. smalltalk.method({
  479. selector: "pc",
  480. fn: function () {
  481. var self=this;
  482. return self.pc;
  483. return self;}
  484. }),
  485. smalltalk.MethodContext);
  486. smalltalk.addMethod(
  487. "_printString",
  488. smalltalk.method({
  489. selector: "printString",
  490. fn: function () {
  491. var self = this;
  492. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.MethodContext.superclass || nil), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
  493. return self;
  494. }
  495. }),
  496. smalltalk.MethodContext);
  497. smalltalk.addMethod(
  498. "_receiver",
  499. smalltalk.method({
  500. selector: "receiver",
  501. fn: function () {
  502. var self = this;
  503. return self.receiver;
  504. return self;
  505. }
  506. }),
  507. smalltalk.MethodContext);
  508. smalltalk.addMethod(
  509. "_selector",
  510. smalltalk.method({
  511. selector: "selector",
  512. fn: function () {
  513. var self = this;
  514. return smalltalk.convertSelector(self.selector);
  515. return self;
  516. }
  517. }),
  518. smalltalk.MethodContext);
  519. smalltalk.addMethod(
  520. "_temps",
  521. smalltalk.method({
  522. selector: "temps",
  523. fn: function () {
  524. var self = this;
  525. return self.temps;
  526. return self;
  527. }
  528. }),
  529. smalltalk.MethodContext);