Pārlūkot izejas kodu

CompiledMethod >> {origin,methodClass}

Herby Vojčík 5 gadi atpakaļ
vecāks
revīzija
f1b07b2b82

+ 1 - 1
package.json

@@ -28,7 +28,7 @@
   },
   "dependencies": {
     "@ambers/contrib-web": ">=0.6.0",
-    "@ambers/lang": ">0.22.6",
+    "@ambers/lang": ">0.23.0",
     "bootstrap": "^3.3.7",
     "codemirror": ">=5.39.2 <5.43.0",
     "es6-promise": "^4.2.4",

+ 7 - 7
src/Helios-Browser.js

@@ -4781,13 +4781,13 @@ selector: "renderItemLabel:on:",
 protocol: "rendering",
 fn: function (aSelector,html){
 var self=this,$self=this;
-var methodClass;
+var origin;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1,$2;
-methodClass=$recv($self._methodForSelector_(aSelector))._methodClass();
-$1=$recv($recv($self._model())._selectedClass()).__eq(methodClass);
+origin=$recv($self._methodForSelector_(aSelector))._origin();
+$1=$recv($recv($self._model())._selectedClass()).__eq(origin);
 if($core.assert($1)){
 $recv(html)._with_(aSelector);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -4802,7 +4802,7 @@ $recv(html)._with_(" ");
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["with:"]=3;
 //>>excludeEnd("ctx");
-$2=$recv("(".__comma($recv(methodClass)._name())).__comma(")");
+$2=$recv("(".__comma($recv(origin)._name())).__comma(")");
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx[","]=1;
 //>>excludeEnd("ctx");
@@ -4810,16 +4810,16 @@ $recv(html)._with_($2);
 }
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aSelector:aSelector,html:html,methodClass:methodClass})});
+}, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aSelector:aSelector,html:html,origin:origin})});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aSelector", "html"],
-source: "renderItemLabel: aSelector on: html\x0a\x09| methodClass |\x0a    \x0a    methodClass := (self methodForSelector: aSelector) methodClass.\x0a\x09self model selectedClass = methodClass\x0a\x09\x09ifTrue: [ html with: aSelector ]\x0a\x09\x09ifFalse: [ html with: aSelector; with: ' '; with: '(', methodClass name, ')' ]",
+source: "renderItemLabel: aSelector on: html\x0a\x09| origin |\x0a    \x0a    origin := (self methodForSelector: aSelector) origin.\x0a\x09self model selectedClass = origin\x0a\x09\x09ifTrue: [ html with: aSelector ]\x0a\x09\x09ifFalse: [ html with: aSelector; with: ' '; with: '(', origin name, ')' ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["methodClass", "methodForSelector:", "ifTrue:ifFalse:", "=", "selectedClass", "model", "with:", ",", "name"]
+messageSends: ["origin", "methodForSelector:", "ifTrue:ifFalse:", "=", "selectedClass", "model", "with:", ",", "name"]
 }),
 $globals.HLMethodsListWidget);
 

+ 4 - 4
src/Helios-Browser.st

@@ -1183,12 +1183,12 @@ renderContentOn: html
 !
 
 renderItemLabel: aSelector on: html
-	| methodClass |
+	| origin |
     
-    methodClass := (self methodForSelector: aSelector) methodClass.
-	self model selectedClass = methodClass
+    origin := (self methodForSelector: aSelector) origin.
+	self model selectedClass = origin
 		ifTrue: [ html with: aSelector ]
-		ifFalse: [ html with: aSelector; with: ' '; with: '(', methodClass name, ')' ]
+		ifFalse: [ html with: aSelector; with: ' '; with: '(', origin name, ')' ]
 ! !
 
 !HLMethodsListWidget methodsFor: 'testing'!

+ 3 - 3
src/Helios-Core.js

@@ -1267,7 +1267,7 @@ $7=$self._selectedMethod();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["selectedMethod"]=1;
 //>>excludeEnd("ctx");
-$6=$recv($7)._methodClass();
+$6=$recv($7)._origin();
 $5=$recv($6)._name();
 $4="Do you REALLY want to remove method ".__comma($5);
 $3=$recv($4).__comma(" >> #");
@@ -1303,11 +1303,11 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "removeMethod\x0a\x09self withChangesDo: [\x0a\x09\x09self manager \x0a\x09\x09\x09confirm: 'Do you REALLY want to remove method ', self selectedMethod methodClass name,' >> #', self selectedMethod selector\x0a\x09\x09\x09ifTrue: [ self environment removeMethod: self selectedMethod ] ]",
+source: "removeMethod\x0a\x09self withChangesDo: [\x0a\x09\x09self manager \x0a\x09\x09\x09confirm: 'Do you REALLY want to remove method ', self selectedMethod origin name,' >> #', self selectedMethod selector\x0a\x09\x09\x09ifTrue: [ self environment removeMethod: self selectedMethod ] ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["withChangesDo:", "confirm:ifTrue:", "manager", ",", "name", "methodClass", "selectedMethod", "selector", "removeMethod:", "environment"]
+messageSends: ["withChangesDo:", "confirm:ifTrue:", "manager", ",", "name", "origin", "selectedMethod", "selector", "removeMethod:", "environment"]
 }),
 $globals.HLToolModel);
 

+ 1 - 1
src/Helios-Core.st

@@ -313,7 +313,7 @@ removeClass
 removeMethod
 	self withChangesDo: [
 		self manager 
-			confirm: 'Do you REALLY want to remove method ', self selectedMethod methodClass name,' >> #', self selectedMethod selector
+			confirm: 'Do you REALLY want to remove method ', self selectedMethod origin name,' >> #', self selectedMethod selector
 			ifTrue: [ self environment removeMethod: self selectedMethod ] ]
 !
 

+ 11 - 11
src/Helios-Helpers.js

@@ -181,7 +181,7 @@ var names,selector;
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1,$2;
-names=$recv($recv($self.method)._methodClass())._allInstanceVariableNames();
+names=$recv($recv($self.method)._origin())._allInstanceVariableNames();
 selector=$recv($self.method)._selector();
 $1=$recv($recv(selector)._last()).__eq(":");
 if($core.assert($1)){
@@ -200,11 +200,11 @@ return true;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "doClassify\x0a\x09| names selector |\x0a\x09\x0a\x09names := method methodClass allInstanceVariableNames.\x0a\x09selector := method selector.\x0a\x09\x0a\x09(selector last = ':')\x0a\x09\x09ifTrue: [ \x22selector might be a setter\x22\x0a\x09\x09\x09selector := selector allButLast ].\x0a\x09\x0a\x09(names includes: selector)\x0a\x09\x09ifFalse: [ ^ false ].\x0a\x09\x09\x0a\x09method protocol: 'accessing'.\x0a\x09^ true.",
+source: "doClassify\x0a\x09| names selector |\x0a\x09\x0a\x09names := method origin allInstanceVariableNames.\x0a\x09selector := method selector.\x0a\x09\x0a\x09(selector last = ':')\x0a\x09\x09ifTrue: [ \x22selector might be a setter\x22\x0a\x09\x09\x09selector := selector allButLast ].\x0a\x09\x0a\x09(names includes: selector)\x0a\x09\x09ifFalse: [ ^ false ].\x0a\x09\x09\x0a\x09method protocol: 'accessing'.\x0a\x09^ true.",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["allInstanceVariableNames", "methodClass", "selector", "ifTrue:", "=", "last", "allButLast", "ifFalse:", "includes:", "protocol:"]
+messageSends: ["allInstanceVariableNames", "origin", "selector", "ifTrue:", "=", "last", "allButLast", "ifFalse:", "includes:", "protocol:"]
 }),
 $globals.HLAccessorClassifier);
 
@@ -227,7 +227,7 @@ return $core.withContext(function($ctx1) {
 var $1,$3,$4,$2;
 var $early={};
 try {
-currentClass=$recv($self.method)._methodClass();
+currentClass=$recv($self.method)._origin();
 $recv((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
@@ -268,11 +268,11 @@ catch(e) {if(e===$early)return e[0]; throw e}
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "doClassify\x0a\x09| currentClass |\x0a\x09currentClass := method methodClass.\x0a\x09\x0a\x09[ currentClass superclass isNil ] whileFalse: [\x0a\x09\x09currentClass := currentClass superclass.\x0a\x09\x09(currentClass includesSelector: method selector)\x0a\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09method protocol: (currentClass >> method selector) protocol.\x0a\x09\x09\x09\x09^ true ]].\x0a\x09\x0a\x09^ false.",
+source: "doClassify\x0a\x09| currentClass |\x0a\x09currentClass := method origin.\x0a\x09\x0a\x09[ currentClass superclass isNil ] whileFalse: [\x0a\x09\x09currentClass := currentClass superclass.\x0a\x09\x09(currentClass includesSelector: method selector)\x0a\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09method protocol: (currentClass >> method selector) protocol.\x0a\x09\x09\x09\x09^ true ]].\x0a\x09\x0a\x09^ false.",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["methodClass", "whileFalse:", "isNil", "superclass", "ifTrue:", "includesSelector:", "selector", "protocol:", "protocol", ">>"]
+messageSends: ["origin", "whileFalse:", "isNil", "superclass", "ifTrue:", "includesSelector:", "selector", "protocol:", "protocol", ">>"]
 }),
 $globals.HLImplementorClassifier);
 
@@ -466,11 +466,11 @@ var protocol;
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
 protocol=$recv($recv(aMethod)._method())._protocol();
-$2=$recv($self.method)._methodClass();
+$2=$recv($self.method)._origin();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx3.sendIdx["methodClass"]=1;
+$ctx3.sendIdx["origin"]=1;
 //>>excludeEnd("ctx");
-$1=$recv($2).__eq($recv(aMethod)._methodClass());
+$1=$recv($2).__eq($recv(aMethod)._origin());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx3.sendIdx["="]=1;
 //>>excludeEnd("ctx");
@@ -533,11 +533,11 @@ catch(e) {if(e===$early)return e[0]; throw e}
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "doClassify\x0a\x09| protocolBag methods protocolToUse counter |\x0a\x09\x0a\x09protocolBag := Dictionary new.\x0a\x09methods := HLReferencesModel new implementorsOf: method selector.\x0a\x09methods\x0a\x09\x09ifEmpty: [ ^ false ]\x0a\x09\x09ifNotEmpty: [\x0a\x09\x09\x09methods \x0a\x09\x09\x09\x09do: [ :aMethod || protocol |\x0a\x09\x09\x09\x09\x09protocol := aMethod method protocol.\x0a\x09\x09\x09\x09\x09(method methodClass = aMethod methodClass)\x0a\x09\x09\x09\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09\x09\x09((protocol first = '*') or: [ protocol = method defaultProtocol ])\x0a\x09\x09\x09\x09\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09\x09\x09\x09\x09protocolBag \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09at: protocol \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09put: (protocolBag at: protocol ifAbsent: [ 0 ]) + 1 ] ] ] ].\x0a\x09\x09\x09\x0a\x09protocolBag ifEmpty: [ ^ false ].\x0a\x09protocolToUse := nil.\x0a\x09counter := 0.\x0a\x09protocolBag keysAndValuesDo: [ :key :value | value > counter \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09counter := value.\x0a\x09\x09\x09protocolToUse := key ] ].\x0a\x09method protocol: protocolToUse.\x0a\x09^ true",
+source: "doClassify\x0a\x09| protocolBag methods protocolToUse counter |\x0a\x09\x0a\x09protocolBag := Dictionary new.\x0a\x09methods := HLReferencesModel new implementorsOf: method selector.\x0a\x09methods\x0a\x09\x09ifEmpty: [ ^ false ]\x0a\x09\x09ifNotEmpty: [\x0a\x09\x09\x09methods \x0a\x09\x09\x09\x09do: [ :aMethod || protocol |\x0a\x09\x09\x09\x09\x09protocol := aMethod method protocol.\x0a\x09\x09\x09\x09\x09(method origin = aMethod origin)\x0a\x09\x09\x09\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09\x09\x09((protocol first = '*') or: [ protocol = method defaultProtocol ])\x0a\x09\x09\x09\x09\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09\x09\x09\x09\x09protocolBag \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09at: protocol \x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09put: (protocolBag at: protocol ifAbsent: [ 0 ]) + 1 ] ] ] ].\x0a\x09\x09\x09\x0a\x09protocolBag ifEmpty: [ ^ false ].\x0a\x09protocolToUse := nil.\x0a\x09counter := 0.\x0a\x09protocolBag keysAndValuesDo: [ :key :value | value > counter \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09counter := value.\x0a\x09\x09\x09protocolToUse := key ] ].\x0a\x09method protocol: protocolToUse.\x0a\x09^ true",
 referencedClasses: ["Dictionary", "HLReferencesModel"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["new", "implementorsOf:", "selector", "ifEmpty:ifNotEmpty:", "do:", "protocol", "method", "ifFalse:", "=", "methodClass", "or:", "first", "defaultProtocol", "at:put:", "+", "at:ifAbsent:", "ifEmpty:", "keysAndValuesDo:", "ifTrue:", ">", "protocol:"]
+messageSends: ["new", "implementorsOf:", "selector", "ifEmpty:ifNotEmpty:", "do:", "protocol", "method", "ifFalse:", "=", "origin", "or:", "first", "defaultProtocol", "at:put:", "+", "at:ifAbsent:", "ifEmpty:", "keysAndValuesDo:", "ifTrue:", ">", "protocol:"]
 }),
 $globals.HLSuperclassClassifier);
 

+ 3 - 3
src/Helios-Helpers.st

@@ -54,7 +54,7 @@ I am a classifier checking the method selector matches an instance variable name
 doClassify
 	| names selector |
 	
-	names := method methodClass allInstanceVariableNames.
+	names := method origin allInstanceVariableNames.
 	selector := method selector.
 	
 	(selector last = ':')
@@ -78,7 +78,7 @@ I am a classifier checking the other implementations of the same selector and ch
 
 doClassify
 	| currentClass |
-	currentClass := method methodClass.
+	currentClass := method origin.
 	
 	[ currentClass superclass isNil ] whileFalse: [
 		currentClass := currentClass superclass.
@@ -151,7 +151,7 @@ doClassify
 			methods 
 				do: [ :aMethod || protocol |
 					protocol := aMethod method protocol.
-					(method methodClass = aMethod methodClass)
+					(method origin = aMethod origin)
 						ifFalse: [
 						((protocol first = '*') or: [ protocol = method defaultProtocol ])
 							ifFalse: [ 

+ 14 - 11
src/Helios-References.js

@@ -789,12 +789,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1;
-$1=$recv($recv($recv($recv(aMethod)._methodClass())._name()).__comma(" >> #")).__comma($recv(aMethod)._selector());
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx[","]=1;
-//>>excludeEnd("ctx");
-$recv(html)._with_($1);
+$recv(html)._with_($recv($recv(aMethod)._method())._asString());
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"renderItemLabel:on:",{aMethod:aMethod,html:html})});
@@ -802,11 +797,11 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aMethod", "html"],
-source: "renderItemLabel: aMethod on: html\x0a\x09html with: aMethod methodClass name, ' >> #', aMethod selector",
+source: "renderItemLabel: aMethod on: html\x0a\x09html with: aMethod method asString",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["with:", ",", "name", "methodClass", "selector"]
+messageSends: ["with:", "asString", "method"]
 }),
 $globals.HLReferencesListWidget);
 
@@ -1105,7 +1100,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return $recv($self._allMethods())._select_((function(each){
+return $recv($self._allMethods())._select_thenCollect_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -1113,6 +1108,14 @@ return $recv($recv(each)._referencedClasses())._includes_(aString);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
 //>>excludeEnd("ctx");
+}),(function(each){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $self._methodReferenceOn_(each);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
+//>>excludeEnd("ctx");
 }));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"classReferencesOf:",{aString:aString})});
@@ -1120,11 +1123,11 @@ return $recv($recv(each)._referencedClasses())._includes_(aString);
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aString"],
-source: "classReferencesOf: aString\x0a\x09\x22Answer all methods referencing the class named aString\x22\x0a\x09\x0a\x09^self allMethods select: [ :each |\x0a\x09\x09\x09(each referencedClasses includes: aString) ].",
+source: "classReferencesOf: aString\x0a\x09\x22Answer all methods referencing the class named aString\x22\x0a\x09\x0a\x09^self allMethods select: [ :each |\x0a\x09\x09\x09(each referencedClasses includes: aString) ] thenCollect: [ :each | self methodReferenceOn: each ].",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["select:", "allMethods", "includes:", "referencedClasses"]
+messageSends: ["select:thenCollect:", "allMethods", "includes:", "referencedClasses", "methodReferenceOn:"]
 }),
 $globals.HLReferencesModel);
 

+ 2 - 2
src/Helios-References.st

@@ -193,7 +193,7 @@ onSearchReferences: aString
 !HLReferencesListWidget methodsFor: 'rendering'!
 
 renderItemLabel: aMethod on: html
-	html with: aMethod methodClass name, ' >> #', aMethod selector
+	html with: aMethod method asString
 ! !
 
 !HLReferencesListWidget class methodsFor: 'instance creation'!
@@ -290,7 +290,7 @@ classReferencesOf: aString
 	"Answer all methods referencing the class named aString"
 	
 	^self allMethods select: [ :each |
-			(each referencedClasses includes: aString) ].
+			(each referencedClasses includes: aString) ] thenCollect: [ :each | self methodReferenceOn: each ].
 !
 
 classesAndMetaclasses