|
@@ -6,9 +6,9 @@ $core.addPackage('Kernel-Classes');
|
|
|
$core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
|
|
|
$core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
|
|
|
|
|
|
-$core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
|
|
|
+$core.addClass('BehaviorBody', $globals.Object, [], 'Kernel-Classes');
|
|
|
|
|
|
-$globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
|
|
|
+$globals.BehaviorBody.comment="I am the superclass of all behaviors.\x0a\x0aMy instances hold the method dictionary.\x0a\x0aI also provides methods for compiling methods and examining the method dictionary.";
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -21,7 +21,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return self._methodAt_(aString);
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -31,7 +31,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["methodAt:"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -93,7 +93,7 @@ announcement=$recv($10)._yourself();
|
|
|
$recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -103,184 +103,7 @@ referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
|
|
|
|
|
|
messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "allInstanceVariableNames",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-var result;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $1,$receiver;
|
|
|
-result=$recv(self._instanceVariableNames())._copy();
|
|
|
-$1=self._superclass();
|
|
|
-
|
|
|
-$ctx1.sendIdx["superclass"]=1;
|
|
|
-
|
|
|
-if(($receiver = $1) == null || $receiver.isNil){
|
|
|
-$1;
|
|
|
-} else {
|
|
|
-$recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
|
|
|
-}
|
|
|
-return result;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "allSelectors",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $1,$2;
|
|
|
-$1=self._allSuperclasses();
|
|
|
-$2=self._selectors();
|
|
|
-
|
|
|
-$ctx1.sendIdx["selectors"]=1;
|
|
|
-
|
|
|
-return $recv($1)._inject_into_($2,(function(acc,each){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-$recv(acc)._addAll_($recv(each)._selectors());
|
|
|
-return $recv(acc)._yourself();
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "allSubclasses",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return $recv($globals.Array)._streamContents_((function(str){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return self._allSubclassesDo_((function(each){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx3) {
|
|
|
-
|
|
|
-return $recv(str)._nextPut_(each);
|
|
|
-
|
|
|
-}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
|
|
|
-referencedClasses: ["Array"],
|
|
|
-
|
|
|
-messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "allSubclassesDo:",
|
|
|
-protocol: 'enumerating',
|
|
|
-fn: function (aBlock){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$core.traverseClassTree(self, function(subclass) {
|
|
|
- if (subclass !== self) aBlock._value_(subclass);
|
|
|
-});
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["aBlock"],
|
|
|
-source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: []
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "allSuperclasses",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $1,$3,$2,$receiver;
|
|
|
-$1=self._superclass();
|
|
|
-
|
|
|
-$ctx1.sendIdx["superclass"]=1;
|
|
|
-
|
|
|
-if(($receiver = $1) == null || $receiver.isNil){
|
|
|
-return [];
|
|
|
-} else {
|
|
|
-$1;
|
|
|
-}
|
|
|
-$3=self._superclass();
|
|
|
-
|
|
|
-$ctx1.sendIdx["superclass"]=2;
|
|
|
-
|
|
|
-$2=$recv($globals.OrderedCollection)._with_($3);
|
|
|
-$recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
|
|
|
-return $recv($2)._yourself();
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
|
|
|
-referencedClasses: ["OrderedCollection"],
|
|
|
-
|
|
|
-messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -294,7 +117,7 @@ return $core.withContext(function($ctx1) {
|
|
|
$core.addMethod(aMethod, self);
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -304,31 +127,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: []
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "basicNew",
|
|
|
-protocol: 'instance creation',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return new self.fn();
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: []
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -342,7 +141,7 @@ return $core.withContext(function($ctx1) {
|
|
|
$core.removeMethod(aMethod,self);
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -352,52 +151,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: []
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "canUnderstand:",
|
|
|
-protocol: 'testing',
|
|
|
-fn: function (aSelector){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $2,$1;
|
|
|
-return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-$2=self._superclass();
|
|
|
-
|
|
|
-$ctx2.sendIdx["superclass"]=1;
|
|
|
-
|
|
|
-$1=$recv($2)._notNil();
|
|
|
-return $recv($1)._and_((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx3) {
|
|
|
-
|
|
|
-return $recv(self._superclass())._canUnderstand_(aSelector);
|
|
|
-
|
|
|
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["aSelector"],
|
|
|
-source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -416,7 +170,7 @@ return "";
|
|
|
return $1;
|
|
|
}
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -426,7 +180,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["ifNil:", "basicAt:"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -446,7 +200,7 @@ $2=$recv($3)._yourself();
|
|
|
$recv($1)._announce_($2);
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -456,7 +210,7 @@ referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
|
|
|
|
|
|
messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -469,7 +223,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -479,7 +233,7 @@ referencedClasses: ["Compiler"],
|
|
|
|
|
|
messageSends: ["install:forClass:protocol:", "new"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -497,42 +251,11 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: []
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "includesBehavior:",
|
|
|
-protocol: 'testing',
|
|
|
-fn: function (aClass){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return $recv(self.__eq_eq(aClass))._or_((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return self._inheritsFrom_(aClass);
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["aClass"],
|
|
|
-source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["or:", "==", "inheritsFrom:"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "includesSelector:",
|
|
|
+selector: "includesSelector:",
|
|
|
protocol: 'testing',
|
|
|
fn: function (aString){
|
|
|
var self=this;
|
|
@@ -541,7 +264,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return $recv(self._methodDictionary())._includesKey_(aString);
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -551,195 +274,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["includesKey:", "methodDictionary"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "inheritsFrom:",
|
|
|
-protocol: 'testing',
|
|
|
-fn: function (aClass){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $1,$3,$2,$receiver;
|
|
|
-$1=self._superclass();
|
|
|
-
|
|
|
-$ctx1.sendIdx["superclass"]=1;
|
|
|
-
|
|
|
-if(($receiver = $1) == null || $receiver.isNil){
|
|
|
-return false;
|
|
|
-} else {
|
|
|
-$1;
|
|
|
-}
|
|
|
-$3=self._superclass();
|
|
|
-
|
|
|
-$ctx1.sendIdx["superclass"]=2;
|
|
|
-
|
|
|
-$2=$recv(aClass).__eq_eq($3);
|
|
|
-return $recv($2)._or_((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $recv(self._superclass())._inheritsFrom_(aClass);
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["aClass"],
|
|
|
-source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "instanceVariableNames",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return self.iVarNames;
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: []
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "isBehavior",
|
|
|
-protocol: 'testing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return true;
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "isBehavior\x0a\x09^ true",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: []
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "javascriptConstructor",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return self.fn;
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: []
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "javascriptConstructor:",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (aJavaScriptFunction){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$core.setClassConstructor(self, aJavaScriptFunction);;
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["aJavaScriptFunction"],
|
|
|
-source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: []
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "lookupSelector:",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (selector){
|
|
|
-var self=this;
|
|
|
-var lookupClass;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $1;
|
|
|
-var $early={};
|
|
|
-try {
|
|
|
-lookupClass=self;
|
|
|
-$recv((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $recv(lookupClass).__eq(nil);
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-
|
|
|
-}))._whileFalse_((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-$1=$recv(lookupClass)._includesSelector_(selector);
|
|
|
-if($core.assert($1)){
|
|
|
-throw $early=[$recv(lookupClass)._methodAt_(selector)];
|
|
|
-}
|
|
|
-lookupClass=$recv(lookupClass)._superclass();
|
|
|
-return lookupClass;
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
-
|
|
|
-}));
|
|
|
-return nil;
|
|
|
-}
|
|
|
-catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: ["selector"],
|
|
|
-source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -752,7 +287,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return $recv(self._methodDictionary())._at_(aString);
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -762,7 +297,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["at:", "methodDictionary"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -783,7 +318,7 @@ var dict = $globals.HashedCollection._new();
|
|
|
return dict;
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -793,7 +328,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: []
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -871,7 +406,7 @@ return $recv(stream)._nextPutAll_("statements");
|
|
|
|
|
|
}));
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -881,7 +416,7 @@ referencedClasses: ["String"],
|
|
|
|
|
|
messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -894,7 +429,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return $recv(self._methodDictionary())._values();
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -904,7 +439,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["values", "methodDictionary"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -925,7 +460,7 @@ return $recv($recv(each)._protocol()).__eq(aString);
|
|
|
|
|
|
}));
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -935,7 +470,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["select:", "methods", "=", "protocol"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -949,7 +484,7 @@ return $core.withContext(function($ctx1) {
|
|
|
return self.className || nil;
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"name",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -959,30 +494,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: []
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "new",
|
|
|
-protocol: 'instance creation',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return $recv(self._basicNew())._initialize();
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "new\x0a\x09^ self basicNew initialize",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: ["initialize", "basicNew"]
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -995,7 +507,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return self._basicAt_("organization");
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1005,7 +517,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["basicAt:"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1039,7 +551,7 @@ return $recv($1).__lt_eq($recv(b)._selector());
|
|
|
|
|
|
}));
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1049,7 +561,7 @@ referencedClasses: ["OrderedCollection"],
|
|
|
|
|
|
messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1070,7 +582,7 @@ return $recv(each)._match_("^\x5c*");
|
|
|
|
|
|
}));
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1080,7 +592,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["reject:", "protocols", "match:"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1101,7 +613,7 @@ return nil;
|
|
|
|
|
|
}));
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1111,7 +623,7 @@ referencedClasses: ["Package"],
|
|
|
|
|
|
messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1124,7 +636,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return $recv($recv(self._organization())._elements())._sorted();
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1134,7 +646,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["sorted", "elements", "organization"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1178,7 +690,7 @@ return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protoc
|
|
|
}));
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1188,31 +700,7 @@ referencedClasses: ["HashedCollection", "Array"],
|
|
|
|
|
|
messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "prototype",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-return self.fn.prototype;
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
|
|
|
-
|
|
|
-},
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-messageSends: []
|
|
|
-}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1225,7 +713,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return $recv($recv($globals.Compiler)._new())._recompile_(self);
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1235,7 +723,7 @@ referencedClasses: ["Compiler"],
|
|
|
|
|
|
messageSends: ["recompile:", "new"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1256,7 +744,7 @@ $2=$recv($3)._yourself();
|
|
|
$recv($1)._announce_($2);
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1266,7 +754,7 @@ referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
|
|
|
|
|
|
messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1296,7 +784,7 @@ return $recv(self._organization())._removeElement_(aString);
|
|
|
}));
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1306,7 +794,7 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
|
|
|
}),
|
|
|
-$globals.Behavior);
|
|
|
+$globals.BehaviorBody);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1319,7 +807,7 @@ return $core.withContext(function($ctx1) {
|
|
|
|
|
|
return $recv(self._methodDictionary())._keys();
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.BehaviorBody)});
|
|
|
|
|
|
},
|
|
|
|
|
@@ -1329,6 +817,590 @@ referencedClasses: [],
|
|
|
|
|
|
messageSends: ["keys", "methodDictionary"]
|
|
|
}),
|
|
|
+$globals.BehaviorBody);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "theMetaClass",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+self._subclassResponsibility();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.BehaviorBody)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "theMetaClass\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}),
|
|
|
+$globals.BehaviorBody);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "theNonMetaClass",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+self._subclassResponsibility();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.BehaviorBody)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "theNonMetaClass\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}),
|
|
|
+$globals.BehaviorBody);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+$core.addClass('Behavior', $globals.BehaviorBody, [], 'Kernel-Classes');
|
|
|
+
|
|
|
+$globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "allInstanceVariableNames",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var result;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1,$receiver;
|
|
|
+result=$recv(self._instanceVariableNames())._copy();
|
|
|
+$1=self._superclass();
|
|
|
+
|
|
|
+$ctx1.sendIdx["superclass"]=1;
|
|
|
+
|
|
|
+if(($receiver = $1) == null || $receiver.isNil){
|
|
|
+$1;
|
|
|
+} else {
|
|
|
+$recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
|
|
|
+}
|
|
|
+return result;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "allSelectors",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1,$2;
|
|
|
+$1=self._allSuperclasses();
|
|
|
+$2=self._selectors();
|
|
|
+
|
|
|
+$ctx1.sendIdx["selectors"]=1;
|
|
|
+
|
|
|
+return $recv($1)._inject_into_($2,(function(acc,each){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$recv(acc)._addAll_($recv(each)._selectors());
|
|
|
+return $recv(acc)._yourself();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "allSubclasses",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $recv($globals.Array)._streamContents_((function(str){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return self._allSubclassesDo_((function(each){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(str)._nextPut_(each);
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
|
|
|
+referencedClasses: ["Array"],
|
|
|
+
|
|
|
+messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "allSubclassesDo:",
|
|
|
+protocol: 'enumerating',
|
|
|
+fn: function (aBlock){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$core.traverseClassTree(self, function(subclass) {
|
|
|
+ if (subclass !== self) aBlock._value_(subclass);
|
|
|
+});
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aBlock"],
|
|
|
+source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "allSuperclasses",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1,$3,$2,$receiver;
|
|
|
+$1=self._superclass();
|
|
|
+
|
|
|
+$ctx1.sendIdx["superclass"]=1;
|
|
|
+
|
|
|
+if(($receiver = $1) == null || $receiver.isNil){
|
|
|
+return [];
|
|
|
+} else {
|
|
|
+$1;
|
|
|
+}
|
|
|
+$3=self._superclass();
|
|
|
+
|
|
|
+$ctx1.sendIdx["superclass"]=2;
|
|
|
+
|
|
|
+$2=$recv($globals.OrderedCollection)._with_($3);
|
|
|
+$recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
|
|
|
+return $recv($2)._yourself();
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
|
|
|
+referencedClasses: ["OrderedCollection"],
|
|
|
+
|
|
|
+messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "basicNew",
|
|
|
+protocol: 'instance creation',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return new self.fn();
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "canUnderstand:",
|
|
|
+protocol: 'testing',
|
|
|
+fn: function (aSelector){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $2,$1;
|
|
|
+return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$2=self._superclass();
|
|
|
+
|
|
|
+$ctx2.sendIdx["superclass"]=1;
|
|
|
+
|
|
|
+$1=$recv($2)._notNil();
|
|
|
+return $recv($1)._and_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv(self._superclass())._canUnderstand_(aSelector);
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aSelector"],
|
|
|
+source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "definition",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return "";
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "definition\x0a\x09^ ''",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "includesBehavior:",
|
|
|
+protocol: 'testing',
|
|
|
+fn: function (aClass){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $recv(self.__eq_eq(aClass))._or_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return self._inheritsFrom_(aClass);
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aClass"],
|
|
|
+source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["or:", "==", "inheritsFrom:"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "inheritsFrom:",
|
|
|
+protocol: 'testing',
|
|
|
+fn: function (aClass){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1,$3,$2,$receiver;
|
|
|
+$1=self._superclass();
|
|
|
+
|
|
|
+$ctx1.sendIdx["superclass"]=1;
|
|
|
+
|
|
|
+if(($receiver = $1) == null || $receiver.isNil){
|
|
|
+return false;
|
|
|
+} else {
|
|
|
+$1;
|
|
|
+}
|
|
|
+$3=self._superclass();
|
|
|
+
|
|
|
+$ctx1.sendIdx["superclass"]=2;
|
|
|
+
|
|
|
+$2=$recv(aClass).__eq_eq($3);
|
|
|
+return $recv($2)._or_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(self._superclass())._inheritsFrom_(aClass);
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aClass"],
|
|
|
+source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "instanceVariableNames",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return self.iVarNames;
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "isBehavior",
|
|
|
+protocol: 'testing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return true;
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "isBehavior\x0a\x09^ true",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "javascriptConstructor",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return self.fn;
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "javascriptConstructor:",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (aJavaScriptFunction){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+$core.setClassConstructor(self, aJavaScriptFunction);;
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aJavaScriptFunction"],
|
|
|
+source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "lookupSelector:",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (selector){
|
|
|
+var self=this;
|
|
|
+var lookupClass;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1;
|
|
|
+var $early={};
|
|
|
+try {
|
|
|
+lookupClass=self;
|
|
|
+$recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(lookupClass).__eq(nil);
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}))._whileFalse_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$1=$recv(lookupClass)._includesSelector_(selector);
|
|
|
+if($core.assert($1)){
|
|
|
+throw $early=[$recv(lookupClass)._methodAt_(selector)];
|
|
|
+}
|
|
|
+lookupClass=$recv(lookupClass)._superclass();
|
|
|
+return lookupClass;
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+return nil;
|
|
|
+}
|
|
|
+catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["selector"],
|
|
|
+source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "new",
|
|
|
+protocol: 'instance creation',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $recv(self._basicNew())._initialize();
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "new\x0a\x09^ self basicNew initialize",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["initialize", "basicNew"]
|
|
|
+}),
|
|
|
+$globals.Behavior);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "prototype",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return self.fn.prototype;
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: []
|
|
|
+}),
|
|
|
$globals.Behavior);
|
|
|
|
|
|
$core.addMethod(
|