Browse Source

Recompile / copy / migrate only recompiles own methods.

Not ones from `uses:`.
Herbert Vojčík 7 years ago
parent
commit
01f8215813
4 changed files with 53 additions and 27 deletions
  1. 14 8
      src/Compiler-Core.js
  2. 2 2
      src/Compiler-Core.st
  3. 33 15
      src/Kernel-Classes.js
  4. 4 2
      src/Kernel-Classes.st

+ 14 - 8
src/Compiler-Core.js

@@ -809,24 +809,30 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$receiver;
+var $1,$2,$3,$receiver;
 $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
+$1=$recv($recv(each)._methodClass()).__eq(aClass);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx2.sendIdx["="]=1;
+//>>excludeEnd("ctx");
+if($core.assert($1)){
 return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
+}
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
 //>>excludeEnd("ctx");
 }),"Recompiling ".__comma($recv(aClass)._name()));
-$1=$recv(aClass)._theMetaClass();
-if(($receiver = $1) == null || $receiver.isNil){
-$1;
+$2=$recv(aClass)._theMetaClass();
+if(($receiver = $2) == null || $receiver.isNil){
+$2;
 } else {
 var meta;
 meta=$receiver;
-$2=$recv(meta).__eq(aClass);
-if(!$core.assert($2)){
+$3=$recv(meta).__eq(aClass);
+if(!$core.assert($3)){
 self._recompile_(meta);
 }
 }
@@ -837,10 +843,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aClass"],
-source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass theMetaClass ifNotNil: [ :meta |\x0a\x09\x09meta = aClass ifFalse: [ self recompile: meta ] ]",
+source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | each methodClass = aClass ifTrue: [ \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ] ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass theMetaClass ifNotNil: [ :meta |\x0a\x09\x09meta = aClass ifFalse: [ self recompile: meta ] ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "=", "recompile:"]
+messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
 }),
 $globals.Compiler);
 

+ 2 - 2
src/Compiler-Core.st

@@ -227,11 +227,11 @@ parseExpression: aString
 
 recompile: aClass
 	aClass methodDictionary values
-		do: [ :each | 
+		do: [ :each | each methodClass = aClass ifTrue: [ 
 			self 
 				install: each source 
 				forClass: aClass 
-				protocol: each protocol ]
+				protocol: each protocol ] ]
 		displayingProgress: 'Recompiling ', aClass name.
 	aClass theMetaClass ifNotNil: [ :meta |
 		meta = aClass ifFalse: [ self recompile: meta ] ]

+ 33 - 15
src/Kernel-Classes.js

@@ -3379,7 +3379,7 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$3,$4,$5,$7,$6,$9,$8;
+var $1,$3,$2,$4,$5,$6,$7,$9,$8,$11,$10,$13,$14,$12;
 $recv(anotherClass)._comment_($recv(aClass)._comment());
 $1=$recv(aClass)._methodDictionary();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -3389,22 +3389,32 @@ $recv($1)._valuesDo_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-$2=$recv($globals.Compiler)._new();
+$3=$recv(each)._methodClass();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx2.sendIdx["methodClass"]=1;
+//>>excludeEnd("ctx");
+$2=$recv($3).__eq(aClass);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx2.sendIdx["="]=1;
+//>>excludeEnd("ctx");
+if($core.assert($2)){
+$4=$recv($globals.Compiler)._new();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["new"]=1;
 //>>excludeEnd("ctx");
-$3=$recv(each)._source();
+$5=$recv(each)._source();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["source"]=1;
 //>>excludeEnd("ctx");
-$4=$recv(each)._protocol();
+$6=$recv(each)._protocol();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["protocol"]=1;
 //>>excludeEnd("ctx");
-return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
+return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["install:forClass:protocol:"]=1;
 //>>excludeEnd("ctx");
+}
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
 //>>excludeEnd("ctx");
@@ -3412,28 +3422,36 @@ $ctx2.sendIdx["install:forClass:protocol:"]=1;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["valuesDo:"]=1;
 //>>excludeEnd("ctx");
-$5=$recv(anotherClass)._class();
+$7=$recv(anotherClass)._class();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["class"]=1;
 //>>excludeEnd("ctx");
-$7=$recv(aClass)._class();
+$9=$recv(aClass)._class();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["class"]=2;
 //>>excludeEnd("ctx");
-$6=$recv($7)._instanceVariableNames();
-self._basicClass_instanceVariables_($5,$6);
-$9=$recv(aClass)._class();
+$8=$recv($9)._instanceVariableNames();
+self._basicClass_instanceVariables_($7,$8);
+$11=$recv(aClass)._class();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["class"]=3;
 //>>excludeEnd("ctx");
-$8=$recv($9)._methodDictionary();
-$recv($8)._valuesDo_((function(each){
+$10=$recv($11)._methodDictionary();
+$recv($10)._valuesDo_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
+$13=$recv(each)._methodClass();
+$14=$recv(aClass)._class();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx2.sendIdx["class"]=4;
+//>>excludeEnd("ctx");
+$12=$recv($13).__eq($14);
+if($core.assert($12)){
 return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
+}
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
 //>>excludeEnd("ctx");
 }));
 return self;
@@ -3443,10 +3461,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aClass", "anotherClass"],
-source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ]",
+source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ]",
 referencedClasses: ["Compiler"],
 //>>excludeEnd("ide");
-messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
+messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
 }),
 $globals.ClassBuilder);
 

+ 4 - 2
src/Kernel-Classes.st

@@ -870,12 +870,14 @@ copyClass: aClass to: anotherClass
 	anotherClass comment: aClass comment.
 
 	aClass methodDictionary valuesDo: [ :each |
-		Compiler new install: each source forClass: anotherClass protocol: each protocol ].
+		each methodClass = aClass ifTrue: [
+			Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].
 
 	self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.
 
 	aClass class methodDictionary valuesDo: [ :each |
-		Compiler new install: each source forClass: anotherClass class protocol: each protocol ]
+		each methodClass = aClass class ifTrue: [
+			Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ]
 ! !
 
 !ClassBuilder methodsFor: 'method definition'!