|
@@ -252,17 +252,18 @@ selector: "beJavaScriptSubclassOf:",
|
|
protocol: "accessing",
|
|
protocol: "accessing",
|
|
|
|
|
|
args: ["aJavaScriptFunction"],
|
|
args: ["aJavaScriptFunction"],
|
|
-source: "beJavaScriptSubclassOf: aJavaScriptFunction\x0a\x09\x22Set the JS constructor to subclass of aJavaScriptFunction.\x0a\x09That way I stay part of (simulated) Smalltalk hierarchy,\x0a\x09but my instances will physically be instanceof aJavaScriptFunction.\x22\x0a\x09\x0a\x09self javaScriptConstructor:\x0a\x09\x09(ClassBuilder new javaScriptSubclassOf: aJavaScriptFunction)",
|
|
+source: "beJavaScriptSubclassOf: aJavaScriptFunction\x0a\x09\x22Reparent the JS constructor's prototype to aJavaScriptFunction's one,\x0a\x09plus bookkeeping. That way I stay part of (simulated) Smalltalk hierarchy,\x0a\x09but my instances will physically be instanceof aJavaScriptFunction.\x22\x0a\x0a\x09self makeJavaScriptConstructorSubclassOf: aJavaScriptFunction.\x0a\x09Smalltalk core detachClass: self",
|
|
-referencedClasses: ["ClassBuilder"],
|
|
+referencedClasses: ["Smalltalk"],
|
|
|
|
|
|
pragmas: [],
|
|
pragmas: [],
|
|
-messageSends: ["javaScriptConstructor:", "javaScriptSubclassOf:", "new"]
|
|
+messageSends: ["makeJavaScriptConstructorSubclassOf:", "detachClass:", "core"]
|
|
}, function ($methodClass){ return function (aJavaScriptFunction){
|
|
}, function ($methodClass){ return function (aJavaScriptFunction){
|
|
var self=this,$self=this;
|
|
var self=this,$self=this;
|
|
|
|
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
-$self._javaScriptConstructor_($recv($recv($globals.ClassBuilder)._new())._javaScriptSubclassOf_(aJavaScriptFunction));
|
|
+$self._makeJavaScriptConstructorSubclassOf_(aJavaScriptFunction);
|
|
|
|
+$recv($recv($globals.Smalltalk)._core())._detachClass_(self);
|
|
return self;
|
|
return self;
|
|
|
|
|
|
}, function($ctx1) {$ctx1.fill(self,"beJavaScriptSubclassOf:",{aJavaScriptFunction:aJavaScriptFunction})});
|
|
}, function($ctx1) {$ctx1.fill(self,"beJavaScriptSubclassOf:",{aJavaScriptFunction:aJavaScriptFunction})});
|
|
@@ -570,6 +571,32 @@ catch(e) {if(e===$early)return e[0]; throw e}
|
|
}; }),
|
|
}; }),
|
|
$globals.Behavior);
|
|
$globals.Behavior);
|
|
|
|
|
|
|
|
+$core.addMethod(
|
|
|
|
+$core.method({
|
|
|
|
+selector: "makeJavaScriptConstructorSubclassOf:",
|
|
|
|
+protocol: "private",
|
|
|
|
+
|
|
|
|
+args: ["javaScriptClass"],
|
|
|
|
+source: "makeJavaScriptConstructorSubclassOf: javaScriptClass\x0a\x09<inlineJS: '\x0a\x09\x09Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);\x0a\x09'>",
|
|
|
|
+referencedClasses: [],
|
|
|
|
+
|
|
|
|
+pragmas: [["inlineJS:", ["\x0a\x09\x09Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);\x0a\x09"]]],
|
|
|
|
+messageSends: []
|
|
|
|
+}, function ($methodClass){ return function (javaScriptClass){
|
|
|
|
+var self=this,$self=this;
|
|
|
|
+
|
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);
|
|
|
|
+ ;
|
|
|
|
+return self;
|
|
|
|
+
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"makeJavaScriptConstructorSubclassOf:",{javaScriptClass:javaScriptClass})});
|
|
|
|
+
|
|
|
|
+}; }),
|
|
|
|
+$globals.Behavior);
|
|
|
|
+
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "new",
|
|
selector: "new",
|
|
@@ -1758,33 +1785,6 @@ return self;
|
|
}; }),
|
|
}; }),
|
|
$globals.ClassBuilder);
|
|
$globals.ClassBuilder);
|
|
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "javaScriptSubclassOf:",
|
|
|
|
-protocol: "class definition",
|
|
|
|
-
|
|
|
|
-args: ["javaScriptClass"],
|
|
|
|
-source: "javaScriptSubclassOf: javaScriptClass\x0a\x09<inlineJS: '\x0a\x09\x09var subclass = function () {};\x0a\x09\x09subclass.prototype = Object.create(javaScriptClass.prototype);\x0a\x09\x09return subclass;'>",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-
|
|
|
|
-pragmas: [["inlineJS:", ["\x0a\x09\x09var subclass = function () {};\x0a\x09\x09subclass.prototype = Object.create(javaScriptClass.prototype);\x0a\x09\x09return subclass;"]]],
|
|
|
|
-messageSends: []
|
|
|
|
-}, function ($methodClass){ return function (javaScriptClass){
|
|
|
|
-var self=this,$self=this;
|
|
|
|
-
|
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var subclass = function () {};
|
|
|
|
- subclass.prototype = Object.create(javaScriptClass.prototype);
|
|
|
|
- return subclass;;
|
|
|
|
-return self;
|
|
|
|
-
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"javaScriptSubclassOf:",{javaScriptClass:javaScriptClass})});
|
|
|
|
-
|
|
|
|
-}; }),
|
|
|
|
-$globals.ClassBuilder);
|
|
|
|
-
|
|
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "migrateClass:superclass:",
|
|
selector: "migrateClass:superclass:",
|