1
0
Kaynağa Gözat

Use TThenable in JSObjectProxy, fix #1223.

Herbert Vojčík 7 yıl önce
ebeveyn
işleme
77c1d3ef1c

+ 117 - 1
src/Kernel-Infrastructure.js

@@ -1,4 +1,4 @@
-define(["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
+define(["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], function($boot){"use strict";
 if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
 var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
 if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
@@ -189,6 +189,44 @@ messageSends: []
 }),
 $globals.JSObjectProxy);
 
+$core.addMethod(
+$core.method({
+selector: "catch:",
+protocol: "promises",
+fn: function (aBlock){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1,$2;
+$1=$recv($globals.NativeFunction)._isNativeFunction_(self._at_("then"));
+if($core.assert($1)){
+return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_(self["@jsObject"],[aBlock]);
+} else {
+$2=(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true,
+//>>excludeEnd("ctx");
+($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($recv(self), [aBlock]));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+return $2;
+}
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aBlock"],
+source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
+referencedClasses: ["NativeFunction", "TThenable"],
+//>>excludeEnd("ide");
+messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
+}),
+$globals.JSObjectProxy);
+
 $core.addMethod(
 $core.method({
 selector: "doesNotUnderstand:",
@@ -297,6 +335,44 @@ messageSends: []
 }),
 $globals.JSObjectProxy);
 
+$core.addMethod(
+$core.method({
+selector: "on:do:",
+protocol: "promises",
+fn: function (aClass,aBlock){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1,$2;
+$1=$recv($globals.NativeFunction)._isNativeFunction_(self._at_("then"));
+if($core.assert($1)){
+return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_(self["@jsObject"],[aClass,aBlock]);
+} else {
+$2=(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true,
+//>>excludeEnd("ctx");
+($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($recv(self), [aClass,aBlock]));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+return $2;
+}
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aClass", "aBlock"],
+source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
+referencedClasses: ["NativeFunction", "TThenable"],
+//>>excludeEnd("ide");
+messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
+}),
+$globals.JSObjectProxy);
+
 $core.addMethod(
 $core.method({
 selector: "printOn:",
@@ -374,6 +450,44 @@ messageSends: ["nextPutJSObject:"]
 }),
 $globals.JSObjectProxy);
 
+$core.addMethod(
+$core.method({
+selector: "then:",
+protocol: "promises",
+fn: function (aBlockOrArray){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1,$2;
+$1=$recv($globals.NativeFunction)._isNativeFunction_(self._at_("then"));
+if($core.assert($1)){
+return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_(self["@jsObject"],[aBlockOrArray]);
+} else {
+$2=(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true,
+//>>excludeEnd("ctx");
+($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($recv(self), [aBlockOrArray]));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+return $2;
+}
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aBlockOrArray"],
+source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
+referencedClasses: ["NativeFunction", "TThenable"],
+//>>excludeEnd("ide");
+messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
+}),
+$globals.JSObjectProxy);
+
 
 $core.addMethod(
 $core.method({
@@ -3494,6 +3608,8 @@ messageSends: ["shouldNotImplement"]
 }),
 $globals.SmalltalkImage.klass);
 
+$core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
+
 $core.addMethod(
 $core.method({
 selector: "asJavaScriptPropertyName",

+ 23 - 0
src/Kernel-Infrastructure.st

@@ -111,6 +111,26 @@ printString
 	'>
 ! !
 
+!JSObjectProxy methodsFor: 'promises'!
+
+catch: aBlock
+(NativeFunction isNativeFunction: (self at: #then))
+	ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]
+	ifFalse: [ ^ super catch: aBlock ]
+!
+
+on: aClass do: aBlock
+(NativeFunction isNativeFunction: (self at: #then))
+	ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]
+	ifFalse: [ ^ super on: aClass do: aBlock ]
+!
+
+then: aBlockOrArray
+(NativeFunction isNativeFunction: (self at: #then))
+	ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]
+	ifFalse: [ ^ super then: aBlockOrArray ]
+! !
+
 !JSObjectProxy methodsFor: 'proxy'!
 
 doesNotUnderstand: aMessage
@@ -944,6 +964,9 @@ new
 	self shouldNotImplement
 ! !
 
+JSObjectProxy setTraitComposition: {TThenable} asTraitComposition!
+! !
+
 !String methodsFor: '*Kernel-Infrastructure'!
 
 asJavaScriptPropertyName

+ 1 - 225
src/Kernel-Promises.js

@@ -1,4 +1,4 @@
-define(["amber/boot", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
+define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
 if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
 var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
 if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
@@ -366,228 +366,4 @@ $globals.TThenable);
 
 $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
 
-$core.addMethod(
-$core.method({
-selector: "catch:",
-protocol: "*Kernel-Promises",
-fn: function (aBlock){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("catch:")
-            ._arguments_([aBlock])
-    );
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlock"],
-source: "catch: aBlock\x0a<inlineJS: '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    )'>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.JSObjectProxy);
-
-$core.addMethod(
-$core.method({
-selector: "on:do:",
-protocol: "*Kernel-Promises",
-fn: function (aClass,aBlock){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("on:do:")
-            ._arguments_([aClass, aBlock])
-    );
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aClass", "aBlock"],
-source: "on: aClass do: aBlock\x0a<inlineJS: '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    )'>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.JSObjectProxy);
-
-$core.addMethod(
-$core.method({
-selector: "on:do:catch:",
-protocol: "*Kernel-Promises",
-fn: function (aClass,aBlock,anotherBlock){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("on:do:catch:")
-            ._arguments_([aClass, aBlock, anotherBlock])
-    );
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aClass", "aBlock", "anotherBlock"],
-source: "on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: '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    )'>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.JSObjectProxy);
-
-$core.addMethod(
-$core.method({
-selector: "then:",
-protocol: "*Kernel-Promises",
-fn: function (aBlockOrArray){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:")
-            ._arguments_([aBlockOrArray])
-    );
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlockOrArray"],
-source: "then: aBlockOrArray\x0a<inlineJS: '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    )'>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.JSObjectProxy);
-
-$core.addMethod(
-$core.method({
-selector: "then:catch:",
-protocol: "*Kernel-Promises",
-fn: function (aBlockOrArray,anotherBlock){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:catch:")
-            ._arguments_([aBlockOrArray, anotherBlock])
-    );
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlockOrArray", "anotherBlock"],
-source: "then: aBlockOrArray catch: anotherBlock\x0a<inlineJS: '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    )'>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.JSObjectProxy);
-
-$core.addMethod(
-$core.method({
-selector: "then:on:do:",
-protocol: "*Kernel-Promises",
-fn: function (aBlockOrArray,aClass,aBlock){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:on:do:")
-            ._arguments_([aBlockOrArray, aClass, aBlock])
-    );
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlockOrArray", "aClass", "aBlock"],
-source: "then: aBlockOrArray on: aClass do: aBlock\x0a<inlineJS: '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    )'>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.JSObjectProxy);
-
-$core.addMethod(
-$core.method({
-selector: "then:on:do:catch:",
-protocol: "*Kernel-Promises",
-fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:on:do:catch:")
-            ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
-    );
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
-source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: '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    )'>",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.JSObjectProxy);
-
 });

+ 0 - 86
src/Kernel-Promises.st

@@ -115,89 +115,3 @@ then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock
 Promise setTraitComposition: {TThenable} asTraitComposition!
 ! !
 
-!JSObjectProxy methodsFor: '*Kernel-Promises'!
-
-catch: aBlock
-<inlineJS: 'var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("catch:")
-            ._arguments_([aBlock])
-    )'>
-!
-
-on: aClass do: aBlock
-<inlineJS: 'var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("on:do:")
-            ._arguments_([aClass, aBlock])
-    )'>
-!
-
-on: aClass do: aBlock catch: anotherBlock
-<inlineJS: 'var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("on:do:catch:")
-            ._arguments_([aClass, aBlock, anotherBlock])
-    )'>
-!
-
-then: aBlockOrArray
-<inlineJS: 'var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:")
-            ._arguments_([aBlockOrArray])
-    )'>
-!
-
-then: aBlockOrArray catch: anotherBlock
-<inlineJS: 'var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:catch:")
-            ._arguments_([aBlockOrArray, anotherBlock])
-    )'>
-!
-
-then: aBlockOrArray on: aClass do: aBlock
-<inlineJS: 'var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:on:do:")
-            ._arguments_([aBlockOrArray, aClass, aBlock])
-    )'>
-!
-
-then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock
-<inlineJS: 'var js = self["@jsObject"];
-if (typeof js.then === "function")
-    return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
-else
-    return self._doesNotUnderstand_(
-        $globals.Message._new()
-            ._selector_("then:on:do:catch:")
-            ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
-    )'>
-! !
-