Kernel-Promises.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. define("amber_core/Kernel-Promises", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Kernel-Promises');
  4. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6. $core.addClass('Thenable', $globals.Object, [], 'Kernel-Promises');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Thenable.comment="I am the abstract base class for Promises.\x0a\x0aMy subclasses should wrap existing JS implementations.\x0a\x0aI contain methods that wrap Promises/A+ `.then` behaviour.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "catch:",
  13. protocol: 'promises',
  14. fn: function (aBlock){
  15. var self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. return self.then(null, function (err) {return $core.seamless(function () {
  20. return aBlock._value_(err);
  21. })});
  22. return self;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  25. //>>excludeEnd("ctx");
  26. },
  27. //>>excludeStart("ide", pragmas.excludeIdeData);
  28. args: ["aBlock"],
  29. source: "catch: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})>",
  30. referencedClasses: [],
  31. //>>excludeEnd("ide");
  32. messageSends: []
  33. }),
  34. $globals.Thenable);
  35. $core.addMethod(
  36. $core.method({
  37. selector: "on:do:",
  38. protocol: 'promises',
  39. fn: function (aClass,aBlock){
  40. var self=this;
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx1) {
  43. //>>excludeEnd("ctx");
  44. return self.then(null, function (err) {return $core.seamless(function () {
  45. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  46. else throw err;
  47. })});
  48. return self;
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  51. //>>excludeEnd("ctx");
  52. },
  53. //>>excludeStart("ide", pragmas.excludeIdeData);
  54. args: ["aClass", "aBlock"],
  55. source: "on: aClass do: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})>",
  56. referencedClasses: [],
  57. //>>excludeEnd("ide");
  58. messageSends: []
  59. }),
  60. $globals.Thenable);
  61. $core.addMethod(
  62. $core.method({
  63. selector: "on:do:catch:",
  64. protocol: 'promises',
  65. fn: function (aClass,aBlock,anotherBlock){
  66. var self=this;
  67. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68. return $core.withContext(function($ctx1) {
  69. //>>excludeEnd("ctx");
  70. return self.then(null, function (err) {return $core.seamless(function () {
  71. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  72. return anotherBlock._value_(err);
  73. })});
  74. return self;
  75. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  77. //>>excludeEnd("ctx");
  78. },
  79. //>>excludeStart("ide", pragmas.excludeIdeData);
  80. args: ["aClass", "aBlock", "anotherBlock"],
  81. source: "on: aClass do: aBlock catch: anotherBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }\x0a return anotherBlock._value_(err);\x0a})})>",
  82. referencedClasses: [],
  83. //>>excludeEnd("ide");
  84. messageSends: []
  85. }),
  86. $globals.Thenable);
  87. $core.addMethod(
  88. $core.method({
  89. selector: "then:",
  90. protocol: 'promises',
  91. fn: function (aBlockOrArray){
  92. var self=this;
  93. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  94. return $core.withContext(function($ctx1) {
  95. //>>excludeEnd("ctx");
  96. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  97. return array.reduce(function (soFar, aBlock) {
  98. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  99. function (result) {return $core.seamless(function () {
  100. if (Array.isArray(result)) {
  101. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  102. } else {
  103. return aBlock._value_(result);
  104. }
  105. })} :
  106. function (result) {return $core.seamless(function () {
  107. return aBlock._value_(result);
  108. })}
  109. );
  110. }, self);
  111. return self;
  112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  113. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  114. //>>excludeEnd("ctx");
  115. },
  116. //>>excludeStart("ide", pragmas.excludeIdeData);
  117. args: ["aBlockOrArray"],
  118. source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length >> 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)>",
  119. referencedClasses: [],
  120. //>>excludeEnd("ide");
  121. messageSends: []
  122. }),
  123. $globals.Thenable);
  124. $core.addMethod(
  125. $core.method({
  126. selector: "then:catch:",
  127. protocol: 'promises',
  128. fn: function (aBlockOrArray,anotherBlock){
  129. var self=this;
  130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  131. return $core.withContext(function($ctx1) {
  132. //>>excludeEnd("ctx");
  133. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  135. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  136. //>>excludeEnd("ctx");
  137. },
  138. //>>excludeStart("ide", pragmas.excludeIdeData);
  139. args: ["aBlockOrArray", "anotherBlock"],
  140. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  141. referencedClasses: [],
  142. //>>excludeEnd("ide");
  143. messageSends: ["catch:", "then:"]
  144. }),
  145. $globals.Thenable);
  146. $core.addMethod(
  147. $core.method({
  148. selector: "then:on:do:",
  149. protocol: 'promises',
  150. fn: function (aBlockOrArray,aClass,aBlock){
  151. var self=this;
  152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  153. return $core.withContext(function($ctx1) {
  154. //>>excludeEnd("ctx");
  155. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  157. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  158. //>>excludeEnd("ctx");
  159. },
  160. //>>excludeStart("ide", pragmas.excludeIdeData);
  161. args: ["aBlockOrArray", "aClass", "aBlock"],
  162. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  163. referencedClasses: [],
  164. //>>excludeEnd("ide");
  165. messageSends: ["on:do:", "then:"]
  166. }),
  167. $globals.Thenable);
  168. $core.addMethod(
  169. $core.method({
  170. selector: "then:on:do:catch:",
  171. protocol: 'promises',
  172. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  173. var self=this;
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. return $core.withContext(function($ctx1) {
  176. //>>excludeEnd("ctx");
  177. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  179. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  180. //>>excludeEnd("ctx");
  181. },
  182. //>>excludeStart("ide", pragmas.excludeIdeData);
  183. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  184. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  185. referencedClasses: [],
  186. //>>excludeEnd("ide");
  187. messageSends: ["catch:", "on:do:", "then:"]
  188. }),
  189. $globals.Thenable);
  190. $core.addClass('Promise', $globals.Thenable, [], 'Kernel-Promises');
  191. $core.addMethod(
  192. $core.method({
  193. selector: "catch:",
  194. protocol: '*Kernel-Promises',
  195. fn: function (aBlock){
  196. var self=this;
  197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  198. return $core.withContext(function($ctx1) {
  199. //>>excludeEnd("ctx");
  200. var js = self["@jsObject"];
  201. if (typeof js.then === "function")
  202. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  203. else
  204. return self._doesNotUnderstand_(
  205. $globals.Message._new()
  206. ._selector_("catch:")
  207. ._arguments_([aBlock])
  208. );
  209. return self;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  212. //>>excludeEnd("ctx");
  213. },
  214. //>>excludeStart("ide", pragmas.excludeIdeData);
  215. args: ["aBlock"],
  216. source: "catch: aBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22catch:\x22)\x0a ._arguments_([aBlock])\x0a )>",
  217. referencedClasses: [],
  218. //>>excludeEnd("ide");
  219. messageSends: []
  220. }),
  221. $globals.JSObjectProxy);
  222. $core.addMethod(
  223. $core.method({
  224. selector: "on:do:",
  225. protocol: '*Kernel-Promises',
  226. fn: function (aClass,aBlock){
  227. var self=this;
  228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  229. return $core.withContext(function($ctx1) {
  230. //>>excludeEnd("ctx");
  231. var js = self["@jsObject"];
  232. if (typeof js.then === "function")
  233. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  234. else
  235. return self._doesNotUnderstand_(
  236. $globals.Message._new()
  237. ._selector_("on:do:")
  238. ._arguments_([aClass, aBlock])
  239. );
  240. return self;
  241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  242. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  243. //>>excludeEnd("ctx");
  244. },
  245. //>>excludeStart("ide", pragmas.excludeIdeData);
  246. args: ["aClass", "aBlock"],
  247. source: "on: aClass do: aBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:\x22)\x0a ._arguments_([aClass, aBlock])\x0a )>",
  248. referencedClasses: [],
  249. //>>excludeEnd("ide");
  250. messageSends: []
  251. }),
  252. $globals.JSObjectProxy);
  253. $core.addMethod(
  254. $core.method({
  255. selector: "on:do:catch:",
  256. protocol: '*Kernel-Promises',
  257. fn: function (aClass,aBlock,anotherBlock){
  258. var self=this;
  259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  260. return $core.withContext(function($ctx1) {
  261. //>>excludeEnd("ctx");
  262. var js = self["@jsObject"];
  263. if (typeof js.then === "function")
  264. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  265. else
  266. return self._doesNotUnderstand_(
  267. $globals.Message._new()
  268. ._selector_("on:do:catch:")
  269. ._arguments_([aClass, aBlock, anotherBlock])
  270. );
  271. return self;
  272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  273. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  274. //>>excludeEnd("ctx");
  275. },
  276. //>>excludeStart("ide", pragmas.excludeIdeData);
  277. args: ["aClass", "aBlock", "anotherBlock"],
  278. source: "on: aClass do: aBlock catch: anotherBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:catch:\x22)\x0a ._arguments_([aClass, aBlock, anotherBlock])\x0a )>",
  279. referencedClasses: [],
  280. //>>excludeEnd("ide");
  281. messageSends: []
  282. }),
  283. $globals.JSObjectProxy);
  284. $core.addMethod(
  285. $core.method({
  286. selector: "then:",
  287. protocol: '*Kernel-Promises',
  288. fn: function (aBlockOrArray){
  289. var self=this;
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. return $core.withContext(function($ctx1) {
  292. //>>excludeEnd("ctx");
  293. var js = self["@jsObject"];
  294. if (typeof js.then === "function")
  295. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  296. else
  297. return self._doesNotUnderstand_(
  298. $globals.Message._new()
  299. ._selector_("then:")
  300. ._arguments_([aBlockOrArray])
  301. );
  302. return self;
  303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  304. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  305. //>>excludeEnd("ctx");
  306. },
  307. //>>excludeStart("ide", pragmas.excludeIdeData);
  308. args: ["aBlockOrArray"],
  309. source: "then: aBlockOrArray\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:\x22)\x0a ._arguments_([aBlockOrArray])\x0a )>",
  310. referencedClasses: [],
  311. //>>excludeEnd("ide");
  312. messageSends: []
  313. }),
  314. $globals.JSObjectProxy);
  315. $core.addMethod(
  316. $core.method({
  317. selector: "then:catch:",
  318. protocol: '*Kernel-Promises',
  319. fn: function (aBlockOrArray,anotherBlock){
  320. var self=this;
  321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  322. return $core.withContext(function($ctx1) {
  323. //>>excludeEnd("ctx");
  324. var js = self["@jsObject"];
  325. if (typeof js.then === "function")
  326. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  327. else
  328. return self._doesNotUnderstand_(
  329. $globals.Message._new()
  330. ._selector_("then:catch:")
  331. ._arguments_([aBlockOrArray, anotherBlock])
  332. );
  333. return self;
  334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  335. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  336. //>>excludeEnd("ctx");
  337. },
  338. //>>excludeStart("ide", pragmas.excludeIdeData);
  339. args: ["aBlockOrArray", "anotherBlock"],
  340. source: "then: aBlockOrArray catch: anotherBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:catch:\x22)\x0a ._arguments_([aBlockOrArray, anotherBlock])\x0a )>",
  341. referencedClasses: [],
  342. //>>excludeEnd("ide");
  343. messageSends: []
  344. }),
  345. $globals.JSObjectProxy);
  346. $core.addMethod(
  347. $core.method({
  348. selector: "then:on:do:",
  349. protocol: '*Kernel-Promises',
  350. fn: function (aBlockOrArray,aClass,aBlock){
  351. var self=this;
  352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  353. return $core.withContext(function($ctx1) {
  354. //>>excludeEnd("ctx");
  355. var js = self["@jsObject"];
  356. if (typeof js.then === "function")
  357. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  358. else
  359. return self._doesNotUnderstand_(
  360. $globals.Message._new()
  361. ._selector_("then:on:do:")
  362. ._arguments_([aBlockOrArray, aClass, aBlock])
  363. );
  364. return self;
  365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  366. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  367. //>>excludeEnd("ctx");
  368. },
  369. //>>excludeStart("ide", pragmas.excludeIdeData);
  370. args: ["aBlockOrArray", "aClass", "aBlock"],
  371. source: "then: aBlockOrArray on: aClass do: aBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock])\x0a )>",
  372. referencedClasses: [],
  373. //>>excludeEnd("ide");
  374. messageSends: []
  375. }),
  376. $globals.JSObjectProxy);
  377. $core.addMethod(
  378. $core.method({
  379. selector: "then:on:do:catch:",
  380. protocol: '*Kernel-Promises',
  381. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  382. var self=this;
  383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  384. return $core.withContext(function($ctx1) {
  385. //>>excludeEnd("ctx");
  386. var js = self["@jsObject"];
  387. if (typeof js.then === "function")
  388. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  389. else
  390. return self._doesNotUnderstand_(
  391. $globals.Message._new()
  392. ._selector_("then:on:do:catch:")
  393. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  394. );
  395. return self;
  396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  397. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  398. //>>excludeEnd("ctx");
  399. },
  400. //>>excludeStart("ide", pragmas.excludeIdeData);
  401. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  402. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:catch:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])\x0a )>",
  403. referencedClasses: [],
  404. //>>excludeEnd("ide");
  405. messageSends: []
  406. }),
  407. $globals.JSObjectProxy);
  408. });